]> git.proxmox.com Git - rustc.git/blob - src/tools/clippy/src/docs/format_in_format_args.txt
New upstream version 1.65.0+dfsg1
[rustc.git] / src / tools / clippy / src / docs / format_in_format_args.txt
1 ### What it does
2 Detects `format!` within the arguments of another macro that does
3 formatting such as `format!` itself, `write!` or `println!`. Suggests
4 inlining the `format!` call.
5
6 ### Why is this bad?
7 The recommended code is both shorter and avoids a temporary allocation.
8
9 ### Example
10 ```
11 println!("error: {}", format!("something failed at {}", Location::caller()));
12 ```
13 Use instead:
14 ```
15 println!("error: something failed at {}", Location::caller());
16 ```