Skip to content

Commit

Permalink
Have clippy warn about uninlined format arguments
Browse files Browse the repository at this point in the history
This makes clippy warn about `format!("{}", var)`, with a
machine-applicable fix converting to `format!("{var}")`.

The `allow-mixed-uninlined-format-args = false` option in `.clippy.toml`
makes clippy issue this warning and provide this fix for individual
format specifiers even if the format string has other specifiers that
can't use inlining.
  • Loading branch information
joshtriplett committed Jul 26, 2024
1 parent 87d9ae5 commit 620a5ce
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions .clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ allow-print-in-tests = true
allow-expect-in-tests = true
allow-unwrap-in-tests = true
allow-dbg-in-tests = true
allow-mixed-uninlined-format-args = false
disallowed-methods = [
{ path = "std::option::Option::map_or", reason = "prefer `map(..).unwrap_or(..)` for legibility" },
{ path = "std::option::Option::map_or_else", reason = "prefer `map(..).unwrap_or_else(..)` for legibility" },
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ string_lit_as_bytes = "warn"
string_to_string = "warn"
todo = "warn"
trait_duplication_in_bounds = "warn"
uninlined_format_args = "warn"
verbose_file_reads = "warn"
wildcard_imports = "warn"
zero_sized_map_values = "warn"
Expand Down

0 comments on commit 620a5ce

Please sign in to comment.