When writing generic bounds such as:
fn foo<T>(a: T) where u32: From<T>;
Into should be preferred, like this:
fn foo<T>(a: T) where T: Into<u32>;
Why the former is bad: Into is a superset of From. In some cases coherence rules prevent implementing From but do allow implementing Into. As a result Into is more generic bound than From.
Category: Style, I guess?
When writing generic bounds such as:
Intoshould be preferred, like this:Why the former is bad:
Intois a superset ofFrom. In some cases coherence rules prevent implementingFrombut do allow implementingInto. As a resultIntois more generic bound thanFrom.Category: Style, I guess?