summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/to_string_in_format_args.txt
blob: 34b20583585ad0fb8fe26778ebb5a816cf4fe825 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
### What it does
Checks for [`ToString::to_string`](https://doc.rust-lang.org/std/string/trait.ToString.html#tymethod.to_string)
applied to a type that implements [`Display`](https://doc.rust-lang.org/std/fmt/trait.Display.html)
in a macro that does formatting.

### Why is this bad?
Since the type implements `Display`, the use of `to_string` is
unnecessary.

### Example
```
println!("error: something failed at {}", Location::caller().to_string());
```
Use instead:
```
println!("error: something failed at {}", Location::caller());
```