Skip to content

Commit 4e00b0f

Browse files
committed
Remove if
1 parent 2e63c35 commit 4e00b0f

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

crates/bitwarden-crypto/src/enc_string/symmetric.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,10 @@ impl std::fmt::Debug for EncString {
218218
fmt_parts(f, enc_type, &[iv, data, mac])
219219
}
220220
EncString::Cose_Encrypt0_B64 { data } => {
221-
if let Ok(msg) = coset::CoseEncrypt0::from_slice(data.as_slice()) {
222-
write!(f, "{}.{:?}", enc_type, msg)?;
223-
} else {
224-
write!(f, "{}.INVALID_COSE", enc_type)?;
225-
}
226-
Ok(())
221+
let msg = coset::CoseEncrypt0::from_slice(data.as_slice())
222+
.map(|msg| format!("{:?}", msg))
223+
.unwrap_or_else(|_| "INVALID_COSE".to_string());
224+
write!(f, "{}.{}", enc_type, msg)
227225
}
228226
}
229227
}

0 commit comments

Comments
 (0)