redundant_closure
doesn't handle Fn
#12853
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
I-suggestion-causes-error
Issue: The suggestions provided by this Lint cause an ICE/error when applied
Uh oh!
There was an error while loading. Please reload this page.
Summary
When a closure
|val| fun(val)
is used wherefun
isFn
, the suggestion is to use it directly asfun
. However, that may not compile and the correct suggestion is&fun
.Lint Name
redundat_closure
Reproducer
I tried this code:
I saw this happen:
and if I apply that fix, I get:
I expected to see this happen (note the ampersand, that's what's missing):
Version
Additional Labels
@rustbot label +I-suggestion-causes-error
The text was updated successfully, but these errors were encountered: