What it does
Detect when FS operations are being done using a fresly-constructed String from Paths. Instead, devs should be using Path::join to avoid an unnecessarily lossy transformation.
Advantage
Code is more robust to paths that are not representable by UTF-8 strings.
Drawbacks
The detection logic might be too difficult to accomplish for the general case.
The correct code might be difficult to automatically suggest.
Example
let p = "foo";
let bar = "bar";
let _ = fs::create_file(format!("{}/bar", p.display()));
let _ = fs::create_file(format!("{}/{}", p.dispaly(), bar.display()));
Could be written as:
let _ = fs::create_file(p.join("bar"));
let _ = fs::create_file(p..join(bar));
Comparison with existing lints
No response
Additional Context
No response
What it does
Detect when FS operations are being done using a fresly-constructed
StringfromPaths. Instead, devs should be usingPath::jointo avoid an unnecessarily lossy transformation.Advantage
Code is more robust to paths that are not representable by UTF-8 strings.
Drawbacks
The detection logic might be too difficult to accomplish for the general case.
The correct code might be difficult to automatically suggest.
Example
Could be written as:
Comparison with existing lints
No response
Additional Context
No response