field_reassign_with_default
false positive with closure capturing variable that was initialized to default
#10136
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
Summary
The
field_reassign_with_default
lint performs a check to make sure that the the reassignment does not involve the variable that was initialized withdefault()
, but this check fails if the variable is captured by a closure.Lint Name
field_reassign_with_default
Reproducer
I tried this code:
I saw this happen:
I expected to see this happen:
The lint should not trigger since the expression that
c.len
is being reassigned to involvesc
, making the suggestion invalid.Version
Additional Labels
@rustbot label +I-suggestion-causes-error
The text was updated successfully, but these errors were encountered: