-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Warn using last and count to exhaust an iterator #78225
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
r? @shepmaster (rust_highfive has picked a reviewer for you, use r? to override) |
There's some discussion in #48926 about when to use Marking this as blocked on #48926. |
Wouldn't |
My guess is that yes, it'd get optimized out. The By the way: the CI is failing because the expected test output still needs to be updated. You can do that by running |
Should I close this or leave it open as blocked? |
It might make sense to make this a clippy lint instead. |
I have a fuzzy memory that @withoutboats may have had thoughts on one of these specifically... |
☔ The latest upstream changes (presumably #76391) made this pull request unmergeable. Please resolve the merge conflicts. |
r? @m-ou-se |
This was briefly discussed in the libs api meeting recently. See rust-lang/libs-team#35 for the guideline we're using now for Feel free to continue the discussion on #48926. |
This adds the same
#[must_use]
attribute as used incollect
tocount
andlast
, as it also does not make sense to not use the result there.