From 8aa44dddb8ea594be57d342b8ca2508fdbf034ff Mon Sep 17 00:00:00 2001 From: Lukas Wagner Date: Thu, 20 Jun 2024 13:50:12 +0200 Subject: [PATCH] pve-rs: tfa: clippy: accessing first element with `.get(0)` Signed-off-by: Lukas Wagner --- pve-rs/src/tfa.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pve-rs/src/tfa.rs b/pve-rs/src/tfa.rs index 7588d6d..7ead18c 100644 --- a/pve-rs/src/tfa.rs +++ b/pve-rs/src/tfa.rs @@ -831,7 +831,7 @@ fn generate_legacy_config(out: &mut perlmod::Hash, config: &TfaConfig) { let users = Hash::new(); for (user, data) in &config.users { - if let Some(u2f) = data.u2f.get(0) { + if let Some(u2f) = data.u2f.first() { let data = Hash::new(); data.insert( "publicKey", @@ -850,7 +850,7 @@ fn generate_legacy_config(out: &mut perlmod::Hash, config: &TfaConfig) { continue; } - if let Some(totp) = data.totp.get(0) { + if let Some(totp) = data.totp.first() { let totp = &totp.entry; let config = Hash::new(); config.insert("digits", Value::new_int(isize::from(totp.digits()))); @@ -873,7 +873,7 @@ fn generate_legacy_config(out: &mut perlmod::Hash, config: &TfaConfig) { continue; } - if let Some(entry) = data.yubico.get(0) { + if let Some(entry) = data.yubico.first() { let mut keys = entry.entry.clone(); for entry in data.yubico.iter().skip(1) {