needless_collect warning, when it's actually needed #7900
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
L-nursery
Lint: Currently in the nursery group
Lint name: needless_collect
I tried this code:
I expected to see no warnings:
Because If I want to read element as
index
, I need to first read all elements before and store them somewhere.So I think collect is appropriate here.
Instead, this happened:
What is more, suggested changes do not compile.
@rustbot label +I-suggestion-causes-error
If I write like this
I, expectedly, get error from rust compiler
Meta
Rust version (
rustc -Vv
):The text was updated successfully, but these errors were encountered: