1
0
Fork 0
mirror of https://github.com/dani-garcia/vaultwarden.git synced 2025-07-04 11:34:59 +00:00

Use more idomatic code

Signed-off-by: BlackDex <black.dex@gmail.com>
This commit is contained in:
BlackDex 2025-06-26 18:29:19 +02:00
parent 33d7486516
commit c62db91ab2
No known key found for this signature in database
GPG key ID: 58C80A2AA6C765E1

View file

@ -152,16 +152,8 @@ async fn activate_yubikey(data: Json<EnableYubikeyData>, headers: Headers, mut c
verify_yubikey_otp(yubikey.to_owned()).await.map_res("Invalid Yubikey OTP provided")?;
}
let yubikey_ids: Vec<String> = yubikeys
.into_iter()
.filter_map(|x| {
if x.len() >= 12 {
Some((x[..12]).to_owned())
} else {
None
}
})
.collect();
let yubikey_ids: Vec<String> =
yubikeys.into_iter().filter_map(|x| (x.len() >= 12).then(|| x[..12].to_owned())).collect();
let yubikey_metadata = YubikeyMetadata {
keys: yubikey_ids,