mirror of
https://gitlab.com/keys.openpgp.org/hagrid.git
synced 2025-10-06 00:23:08 +02:00
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:
@@ -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
|
||||
}
|
||||
|
||||
|
@@ -363,7 +363,7 @@ fn show_upload_verify(
|
||||
.collect();
|
||||
let primary_uid = tpk_status
|
||||
.email_status
|
||||
.get(0)
|
||||
.first()
|
||||
.map(|(email, _)| email)
|
||||
.cloned();
|
||||
|
||||
|
Reference in New Issue
Block a user