Wrong suggestion for redundant_closure_call
when body contains return
, ?
or try!
.
#1684
Labels
C-bug
Category: Clippy is not doing the correct thing
Test case:
Clippy will suggest
But the suggestion is wrong, because the
?
will propagate the error outside the block. Similar problem for early-return
.Clippy should avoid generating
redundant_closure_call
if?
is present in the body.After
catch
expression is stablized (rust-lang/rust#31436,#![feature(catch_expr)]
), the lint could be re-enabled when the body only contains?
. The suggestion should belet e = catch { … }
though.Not sure about early-
return
(includingtry!
), maybe just turn off the code suggestion, and recommend the coder to restructure the expression.The text was updated successfully, but these errors were encountered: