False positive with map_clone
#12271
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
calling
.map(|foo| U::clone(...))
on anOption<&T>
or Iterator over&T
incorrectly triggers themap_clone
lint.Notes:
&T
U
can be any type that implementsClone
.map(|foo| U::clone(&foo))
, the lint will trigger no matter what value is put intoU::clone
(foo can be unused)Lint Name
map_clone
Reproducer
I tried this code:
I saw this happen:
I expected to see this happen:
map_clone
not triggering.The same issue appears with
Version
Additional Labels
@rustbot label +I-suggestion-causes-error
The text was updated successfully, but these errors were encountered: