Clean up linting warnings: accessing first element with index 0.

Commands:

    cargo clippy --tests --no-deps --workspace

Warnings:

    warning: accessing first element with `self.catalogs.get(0)`
      --> src/i18n.rs:21:32
       |
    21 |             .unwrap_or_else(|| self.catalogs.get(0).unwrap());
       |                                ^^^^^^^^^^^^^^^^^^^^ help: try: `self.catalogs.first()`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first
       = note: `#[warn(clippy::get_first)]` on by default

    warning: accessing first element with `tpk_status
                     .email_status.get(0)`
       --> src/web/vks.rs:364:23
        |
    364 |       let primary_uid = tpk_status
        |  _______________________^
    365 | |         .email_status
    366 | |         .get(0)
        | |_______________^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first
    help: try
        |
    364 ~     let primary_uid = tpk_status
    365 +         .email_status.first()
        |
This commit is contained in:
Zeke Fast
2025-04-27 16:59:14 +02:00
parent 57a8e3a3a8
commit f4699a4545
2 changed files with 2 additions and 2 deletions

View File

@@ -18,7 +18,7 @@ impl I18NHelper {
.catalogs
.iter()
.find(|(candidate, _)| *candidate == lang)
.unwrap_or_else(|| self.catalogs.get(0).unwrap());
.unwrap_or_else(|| self.catalogs.first().unwrap());
catalog
}

View File

@@ -363,7 +363,7 @@ fn show_upload_verify(
.collect();
let primary_uid = tpk_status
.email_status
.get(0)
.first()
.map(|(email, _)| email)
.cloned();