clippy::redundant_closure: false positive when function returns ! but closure doesn't #8416
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
For tests I have a mock for
std::process::exit()
that needs to return, so whenstd::process::exit()
is passed in as the callback I wrap it in a closure to change the return type from ! to ().Lint Name
clippy::redundant_closure
Reproducer
I tried this code:
I saw this happen:
I applied the suggestion:
This fails to compile with the error:
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: