fix clippy warings in fido code

This commit is contained in:
Fabrice Bellamy
2026-03-02 15:17:33 +01:00
parent 790966d4cb
commit c18d496b90
2 changed files with 16 additions and 18 deletions
+5 -6
View File
@@ -1506,12 +1506,11 @@ impl HidTransport {
// 4. For others, sign the subcommand byte followed by the CBOR-encoded SubCommandParams map.
let mut message = vec![sub_cmd];
if let Some(params) = sub_params_bytes {
if sub_cmd != CredentialMgmtSubCommand::GetCredsMetadata as u8
&& sub_cmd != CredentialMgmtSubCommand::EnumerateRpsBegin as u8
{
message.extend(params);
}
if let Some(params) = sub_params_bytes
&& sub_cmd != CredentialMgmtSubCommand::GetCredsMetadata as u8
&& sub_cmd != CredentialMgmtSubCommand::EnumerateRpsBegin as u8
{
message.extend(params);
}
log::debug!(
+11 -12
View File
@@ -141,14 +141,13 @@ pub(crate) fn get_fido_info() -> Result<FidoDeviceInfo, String> {
0x0A => {
if let Value::Array(arr) = val {
for v in arr {
if let Value::Map(m) = v {
if let Some(Value::Integer(alg_id)) = m.get(&Value::Text("alg".into()))
{
if let Some(alg) = CoseAlgorithm::from_i128(*alg_id) {
algorithms.push(alg.to_string());
} else {
algorithms.push(format!("Unknown ({})", alg_id));
}
if let Value::Map(m) = v
&& let Some(Value::Integer(alg_id)) = m.get(&Value::Text("alg".into()))
{
if let Some(alg) = CoseAlgorithm::from_i128(*alg_id) {
algorithms.push(alg.to_string());
} else {
algorithms.push(format!("Unknown ({})", alg_id));
}
}
}
@@ -429,10 +428,10 @@ pub(crate) fn get_credentials(pin: String) -> Result<Vec<StoredCredential>, Stri
}
// Parse Credential ID Descriptor
if let Value::Map(m) = &cred.credential_id {
if let Some(Value::Bytes(b)) = m.get(&Value::Text("id".into())) {
stored_cred.credential_id = hex::encode(b);
}
if let Value::Map(m) = &cred.credential_id
&& let Some(Value::Bytes(b)) = m.get(&Value::Text("id".into()))
{
stored_cred.credential_id = hex::encode(b);
}
all_credentials.push(stored_cred);