Skip to content
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

double_ended_iterator_last should not trigger on immutable non-ref receiver #14139

Open
samueltardieu opened this issue Feb 2, 2025 · 1 comment · May be fixed by #14140
Open

double_ended_iterator_last should not trigger on immutable non-ref receiver #14139

samueltardieu opened this issue Feb 2, 2025 · 1 comment · May be fixed by #14140
Assignees
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

Comments

@samueltardieu
Copy link
Contributor

Summary

See title

Lint Name

double_ended_iterator_last

Reproducer

fn main() {
    let mut index = [true,true,false,false,false,true].iter();
    let subindex = index.by_ref().take(3);
    subindex.last();
}

suggests using subindex.next_back() which won't work because subindex cannot be auto-derefed into a ref mut.

Version

rustc 1.86.0-nightly (2f348cb7c 2025-01-27)
binary: rustc
commit-hash: 2f348cb7ce4063fa4eb40038e6ada3c5214717bd
commit-date: 2025-01-27
host: x86_64-unknown-linux-gnu
release: 1.86.0-nightly
LLVM version: 19.1.7

Additional Labels

No response

@samueltardieu samueltardieu added 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 labels Feb 2, 2025
@samueltardieu samueltardieu self-assigned this Feb 2, 2025
@samueltardieu
Copy link
Contributor Author

Signaled in #13922 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant