You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When importing names that are not used directly, but used as a trait, I think it is better to use the as _ clause to avoid polluting current scope with unused names.
Advantage
does not introduce unused names into the current scope
fewer potential "got-chas"
Drawbacks
No response
Example
// the `Write` here is never actually useduse std::fmt::Write;fnmain(){letmut s = String::new();let _ = write!(s,"hello, world!");println!("{s}");}
Could be written as:
use std::fmt::Writeas _;
...
bayov, DCNick3, tomkarw, desbma, RuairidhWilliamson and 3 more