about summary refs log tree commit diff
path: root/src/docs/format_in_format_args.txt
blob: ac498472f017f04a35c2a7017e599dc40f3034d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
### What it does
Detects `format!` within the arguments of another macro that does
formatting such as `format!` itself, `write!` or `println!`. Suggests
inlining the `format!` call.

### Why is this bad?
The recommended code is both shorter and avoids a temporary allocation.

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