diff options
Diffstat (limited to 'src/tools/clippy/src/docs/format_in_format_args.txt')
-rw-r--r-- | src/tools/clippy/src/docs/format_in_format_args.txt | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/format_in_format_args.txt b/src/tools/clippy/src/docs/format_in_format_args.txt new file mode 100644 index 000000000..ac498472f --- /dev/null +++ b/src/tools/clippy/src/docs/format_in_format_args.txt @@ -0,0 +1,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()); +```
\ No newline at end of file |