pve-rs: tfa: clippy: accessing first element with .get(0)

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
This commit is contained in:
Lukas Wagner 2024-06-20 13:50:12 +02:00 committed by Thomas Lamprecht
parent 824b39583d
commit 8aa44dddb8

View File

@ -831,7 +831,7 @@ fn generate_legacy_config(out: &mut perlmod::Hash, config: &TfaConfig) {
let users = Hash::new(); let users = Hash::new();
for (user, data) in &config.users { 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(); let data = Hash::new();
data.insert( data.insert(
"publicKey", "publicKey",
@ -850,7 +850,7 @@ fn generate_legacy_config(out: &mut perlmod::Hash, config: &TfaConfig) {
continue; continue;
} }
if let Some(totp) = data.totp.get(0) { if let Some(totp) = data.totp.first() {
let totp = &totp.entry; let totp = &totp.entry;
let config = Hash::new(); let config = Hash::new();
config.insert("digits", Value::new_int(isize::from(totp.digits()))); 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; continue;
} }
if let Some(entry) = data.yubico.get(0) { if let Some(entry) = data.yubico.first() {
let mut keys = entry.entry.clone(); let mut keys = entry.entry.clone();
for entry in data.yubico.iter().skip(1) { for entry in data.yubico.iter().skip(1) {