Remove an unnecessary .move_iter().collect()#14139
Closed
SimonSapin wants to merge 1 commit intorust-lang:masterfrom
Closed
Remove an unnecessary .move_iter().collect()#14139SimonSapin wants to merge 1 commit intorust-lang:masterfrom
SimonSapin wants to merge 1 commit intorust-lang:masterfrom
Conversation
Contributor
|
This is almost certainly left over from |
Contributor
Author
|
Ah, I see. I suppose this was added when |
flip1995
pushed a commit
to flip1995/rust
that referenced
this pull request
Feb 20, 2025
) In the case where `iter` is a `DoubleEndedIterator`, replacing a call to `iter.last()` (which consumes `iter`) by `iter.next_back()` (which requires a mutable reference to `iter`) cannot be done when `iter` is a non-mutable binding which is not a mutable reference. When possible, a local immutable binding is made into a mutable one. Also, the applicability is switched to `MaybeIncorrect` and a note is added to the output when the element types have a significant drop, because the drop order will potentially be modified because `.next_back()` does not consume the iterator nor the elements before the last one. Fix rust-lang#14139 changelog: [`double_ended_iterator_last`]: do not trigger on non-reference immutable receiver, and warn about possible drop order change
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Well, at least it looks unnecessary. This is completely untested. I’m leaving that job to bors, if that’s ok.