-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
needless_collect - false positive? #5991
Comments
Adding to this, I've also encountered a needless_collect false positive today here: https://github.com/ZcashFoundation/zebra/pull/1016/files/409a2289b57aa71cacbf19b17f6f5839890092e3#diff-94ae6030e39498920ff1ee31c52222efR319-R320 |
Also another false positive here:
clippy doesn't see that the double collect is needed to get the iterator to be a double ended iterator as required by .rev() |
+1. I think I've also encountered a false positive here (see this CI failure log). |
Clippy doesn't understand that we use collect to get a double-ended iterator. See rust-lang/rust-clippy#5991 (comment)
Clippy doesn't understand that we use collect to get a double-ended iterator. See rust-lang/rust-clippy#5991 (comment)
Clippy doesn't understand that we use collect to get a double-ended iterator. See rust-lang/rust-clippy#5991 (comment)
Hey everyone, I stumbled over this issue while updating my version of clippy. I was able to reproduce the issue with a simplification of the original code in a rustlang playground and it looks something like this.
Please ignore the
filter_map
warning. It's due to my simplification of the code and does not appear in the original code base.Here, clippy throws the
needless_collect
warning, but I am not sure how I should proceed in that case. It seems to me that the collect is actually required for using the.contains()
later on and getting rid of it would make things more complicated. I was able to clean up code in a couple of other places whereneedless_collect
warnings popped up, but I'm not sure about this bit.The playground uses rust version 1.46.0-stable and clippy version 0.0.212. A direct link to the playground can be found here:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=9fd8c2407aefab646fa97e13088f47c0
I'm not sure how to create a backtrace from the playground, but if desired I can add this to the issue by running it locally as well.
Thanks for working on clippy!
Bjoern
The text was updated successfully, but these errors were encountered: