False positive redundant_closure when using ref pattern in closure params #8460
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
Summary
Related to #3071 which was fixed in #7661, I found a bug when using the
ref
pattern in a closure's parameters ie|ref foo| bar(foo)
Lint Name
redundant-closure
Reproducer
I tried this code:
Note that the first statement in
main
triggers expected behavior - there is no redundant closure, and so the lint is not triggered. However, as in the issue referenced above,redundant-closure
is triggered for the second statement, with the suggestion being the third (commented-out) statement - this is unexpected behavior, since the suggested code fails to type-check and causes a compiler error.playground (with
allows
to isolate lint): https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=ec6a0ed2580e8fc73146abf6ada9b384Version
No response
Additional Labels
No response
The text was updated successfully, but these errors were encountered: