Fix most Clippy warnings.

This commit is contained in:
Guillaume Endignoux
2020-09-23 16:21:20 +02:00
parent 616476ac43
commit 5511811703
8 changed files with 16 additions and 5 deletions

View File

@@ -325,7 +325,7 @@ impl TryFrom<cbor::Value> for AuthenticatorClientPinParameters {
let key_agreement = key_agreement
.map(extract_map)
.transpose()?
.map(|x| CoseKey(x));
.map(CoseKey);
let pin_auth = pin_auth.map(extract_byte_string).transpose()?;
let new_pin_enc = new_pin_enc.map(extract_byte_string).transpose()?;
let pin_hash_enc = pin_hash_enc.map(extract_byte_string).transpose()?;

View File

@@ -694,7 +694,7 @@ where
key_id: credential.credential_id.clone(),
transports: None, // You can set USB as a hint here.
};
let user = if (flags & UV_FLAG != 0) && (credential.user_handle.len() > 0) {
let user = if (flags & UV_FLAG != 0) && !credential.user_handle.is_empty() {
Some(PublicKeyCredentialUserEntity {
user_id: credential.user_handle.clone(),
user_name: None,

View File

@@ -88,6 +88,7 @@ const _DEFAULT_MIN_PIN_LENGTH_RP_IDS: Vec<String> = Vec::new();
#[cfg(feature = "with_ctap2_1")]
const _MAX_RP_IDS_LENGTH: usize = 8;
#[allow(clippy::enum_variant_names)]
#[derive(PartialEq, Eq, PartialOrd, Ord)]
enum Key {
// TODO(cretin): Test whether this doesn't consume too much memory. Otherwise, we can use less
@@ -406,10 +407,11 @@ impl PersistentStore {
data: pin_hash,
sensitive: true,
};
Ok(match self.store.find_one(&Key::PinHash) {
match self.store.find_one(&Key::PinHash) {
None => self.store.insert(entry)?,
Some((index, _)) => self.store.replace(index, entry)?,
})
}
Ok(())
}
pub fn pin_retries(&self) -> Result<u8, Ctap2StatusCode> {