-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
A-lintArea: New lintsArea: New lints
Description
What it does
Warn when a Debug representation of Path is used in format! or println!, instead of path.display().
Advantage
Rust doesn't guarantee how Debug formatting looks like, and it could change in the future. For printing paths there's the dedicated .display() method.
Drawbacks
Not every Debug print of a Path is incorrect: it may be used in dbg!(), or when a PathBuf is a field in a struct that is Debug-printed as a whole.
Example
let path = Path::new("…");
println!("The path is {:?}", path);Could be written as:
let path = Path::new("…");
println!("The path is {}", path.display());smoelius and RRRadicalEdward
Metadata
Metadata
Assignees
Labels
A-lintArea: New lintsArea: New lints