Open
Description
What it does
When format!("{x}")
or format!("{}", x)
is used and the type of x
implements fmt::Display
, clippy
should suggest using .to_string()
directly
I'm not sure if there's already an issue for this, but I couldn't find one
Advantage
No response
Drawbacks
No response
Example
let addr = SocketAddr::from(([127, 0, 0, 1], 80));
let addr_string = format!("{addr}");
Could be written as:
let addr = SocketAddr::from(([127, 0, 0, 1], 80));
let addr_string = addr.to_string();