needless_collect doesn't take into account side-effects #8055
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
L-nursery
Lint: Currently in the nursery group
Summary
needless_collect does not take into account side effects of the iterator, and so spuriously reports a necessary collect as needless.
Lint Name
needless_collect
Reproducer
I tried this code:
playground https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=35738bf7ad2c8bcba6b8431afd61e527
I saw this happen:
I expected to see this happen: no warning
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: