Given where clauses are only elaborated for supertraits, and not other things · Issue #20671 · rust-lang/rust, what do you generally prefer?

pub trait OsError: Error + Send + Sync + 'static // C-GOOD-ERR + From<io::Error> + Into<DeviceError> // <--- Into bound - ugly { ... } 
pub trait OsError: Error + Send + Sync + 'static // C-GOOD-ERR + From<io::Error> where DeviceError: From<Self> // <--- not implied, adds noise at usage sites { ... } 

I really dislike anything that nudges towards anyone thinking to impl Into. I also find Foo::from(bar) to be generally more readable than Into::<Foo>::into(bar) where types need to be explicit. And specifying Into means that From cannot be guaranteed at call sites, while specifying From allows for either to be used.
But the additional noise from the where-clause is equally ugly, given that it is avoidable in this one specific situation ...

3 posts - 3 participants

Read full topic