Open
Description
What it does
Warn that .to_string()
is only required once. Even with pedantic clippy this doesn't give any warning.
Advantage
It can happen to anyone if you process a lot of code that you accidently call .to_string()
more then once on a variable. It takes up useless characters in your file and looks sloppy. This looks like something clippy could fix automatically with the --fix
argument.
Drawbacks
I can't think of any since I don't know any situation where it would make sense to call .to_string()
twice in a variable.
Example
let uri = req.uri().path().to_string().to_string();
Could be written as:
let uri = req.uri().path().to_string();