drop_ref should not trigger when drop is used in a match branch #10122
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
This bug is similar to #9482 but for
drop_ref
instead ofdrop_copy
.I would similarly argue that if
drop()
is called on the result of a function (or other expression with side-effects) as a match branch (i.e. the code contains something like=> drop(expr_with_side_effects),
) then thedrop_ref
lint should not trigger becausedrop()
is not used to drop the value but to ignore the value.The fix may be similar to #9491.
Lint Name
drop_ref
Reproducer
I tried this code:
I saw this happen:
I expected to see this happen:
No error
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: