Lifetime error following unnecessary_to_owned
going from .to_vec().into_iter()
to .iter().copied()
#14711
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
As closures don't allow to specify that the returntype has the same lifetime as the input, it's in this case required to clone the input and return a owned value. In this case the iterator would borrow
b
and therefore clippy's suggestion to replace it with.iter().copied()
results in a lifetime error.Lint Name
unnecessary_to_owned
Reproducer
I tried this code:
I saw this happen:
I expected to see this happen:
Nothing at all
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: