useless conversion wrongly suggests removing .into_iter() when ExactSizeIterator is required #11300
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
I have a function that takes an argument implementing
IntoIterator + ExactSizeIterator
. When I call it, I supply an array with.into_iter()
. Clippy wrongly suggests removing the.into_iter()
on the grounds that it's automatic. However, if I do that then the code fails to compile becauseExactSizeIterator
is not satisfied.Lint Name
useless_conversion
Reproducer
I tried this code:
I saw this happen:
I expected to see this happen:
No errors.
If I apply Clippy's suggest and remove the
.into_iter()
, then this happens:Version
Additional Labels
@rustbot label +
I-suggestion-causes-error
The text was updated successfully, but these errors were encountered: