Lint against panic!(format!(...))
and assert!(..., format!(...))
#6259
Labels
A-lint
Area: New lints
panic!(format!(...))
and assert!(..., format!(...))
#6259
What it does
assert!
andpanic!
have built-in support for formatting, but they also accept arguments of typeString
, so one could useformat!
instead.Using
format!
here is entirely unnecessary, and yet happens in the wild, so this seems like a useful target for a Clippy lint. Also the long-term plan is to not supportString
arguments any more, so such code might not work in future editions.Cc @m-ou-se
Example
Could be written as:
The text was updated successfully, but these errors were encountered: