]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/src/docs/to_string_in_format_args.txt
Auto merge of #104673 - matthiaskrgr:rollup-85f65ov, r=matthiaskrgr
[rust.git] / src / tools / clippy / src / docs / to_string_in_format_args.txt
1 ### What it does
2 Checks for [`ToString::to_string`](https://doc.rust-lang.org/std/string/trait.ToString.html#tymethod.to_string)
3 applied to a type that implements [`Display`](https://doc.rust-lang.org/std/fmt/trait.Display.html)
4 in a macro that does formatting.
5
6 ### Why is this bad?
7 Since the type implements `Display`, the use of `to_string` is
8 unnecessary.
9
10 ### Example
11 ```
12 println!("error: something failed at {}", Location::caller().to_string());
13 ```
14 Use instead:
15 ```
16 println!("error: something failed at {}", Location::caller());
17 ```