expect_fun_call
recommends code which is not equivalent
#2928
Labels
A-documentation
Area: Adding or improving documentation
C-enhancement
Category: Enhancement of lints, like adding more cases or adding help messages
L-suggestion
Lint: Improving, adding or fixing lint suggestions
Clippy will suggest replacing:
with
However, these are not equivalent. The first outputs
foo: "bar"
, while the second will only outputbar
. Clippy could recommend doing the same formatting as expect, now we're literally recommending replacingexpect
with the exact body of that function. While it does of course avoid a single string allocation, it seems like a very aggressive lint to have on by default to avoid a case that is insignificant performance-wise for the vast majority of programs.format!
should be white listed here IMOThe text was updated successfully, but these errors were encountered: