Skip to content

More iter().last() -> last(), iter().next() -> first() #145402

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Aug 14, 2025

r? @estebank

Follow-up to #145401, which was missing some cases. Also change .iter().next() -> .first() when applicable.

@rustbot rustbot added A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 14, 2025
@rustbot
Copy link
Collaborator

rustbot commented Aug 14, 2025

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

rustc_errors::emitter was changed

cc @Muscraft

rustc_macros::diagnostics was changed

cc @davidtwco, @compiler-errors, @TaKO8Ki

@estebank
Copy link
Contributor

r=me

@estebank
Copy link
Contributor

also filed rust-lang/rust-clippy#15487

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer
Copy link
Collaborator

The job pr-check-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Checking rustc_codegen_cranelift v0.1.0 (/checkout/compiler/rustc_codegen_cranelift)
error[E0599]: no method named `first` found for struct `SwitchTargetsIter` in the current scope
   --> compiler/rustc_codegen_cranelift/src/base.rs:442:71
    |
442 |                     || (targets.iter().count() == 1 && targets.iter().first().unwrap().0 == 0);
    |                                                                       ^^^^^ method not found in `SwitchTargetsIter<'_>`

error[E0599]: no method named `first` found for struct `SwitchTargetsIter` in the current scope
   --> compiler/rustc_codegen_cranelift/src/base.rs:445:67
    |
445 |                     let (then_value, then_block) = targets.iter().first().unwrap();
    |                                                                   ^^^^^ method not found in `SwitchTargetsIter<'_>`

For more information about this error, try `rustc --explain E0599`.
[RUSTC-TIMING] rustc_codegen_cranelift test:false 1.081
error: could not compile `rustc_codegen_cranelift` (lib) due to 2 previous errors
Build completed unsuccessfully in 0:02:25

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be done in the cg_clif repo instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants