Fix more Clippy warnings.
This commit is contained in:
@@ -1252,7 +1252,7 @@ mod test {
|
||||
let mut rng = ThreadRng256 {};
|
||||
let sk = crypto::ecdh::SecKey::gensk(&mut rng);
|
||||
let pk = sk.genpk();
|
||||
let cose_key = CoseKey::from(pk.clone());
|
||||
let cose_key = CoseKey::from(pk);
|
||||
let cbor_extensions = cbor_map! {
|
||||
"hmac-secret" => cbor_map! {
|
||||
1 => cbor::Value::Map(cose_key.0.clone()),
|
||||
|
||||
@@ -137,6 +137,7 @@ impl CtapHid {
|
||||
const TIMEOUT_DURATION: Duration<isize> = Duration::from_ms(100);
|
||||
const WINK_TIMEOUT_DURATION: Duration<isize> = Duration::from_ms(5000);
|
||||
|
||||
#[allow(clippy::new_without_default)]
|
||||
pub fn new() -> CtapHid {
|
||||
CtapHid {
|
||||
assembler: MessageAssembler::new(),
|
||||
|
||||
@@ -49,6 +49,12 @@ pub enum Error {
|
||||
Timeout,
|
||||
}
|
||||
|
||||
impl Default for MessageAssembler {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl MessageAssembler {
|
||||
pub fn new() -> MessageAssembler {
|
||||
MessageAssembler {
|
||||
|
||||
@@ -777,7 +777,7 @@ mod test {
|
||||
#[test]
|
||||
fn test_process_get_pin_retries() {
|
||||
let mut rng = ThreadRng256 {};
|
||||
let mut persistent_store = PersistentStore::new(&mut rng);
|
||||
let persistent_store = PersistentStore::new(&mut rng);
|
||||
let pin_protocol_v1 = PinProtocolV1::new(&mut rng);
|
||||
let expected_response = Ok(AuthenticatorClientPinResponse {
|
||||
key_agreement: None,
|
||||
@@ -785,7 +785,7 @@ mod test {
|
||||
retries: Some(persistent_store.pin_retries().unwrap() as u64),
|
||||
});
|
||||
assert_eq!(
|
||||
pin_protocol_v1.process_get_pin_retries(&mut persistent_store),
|
||||
pin_protocol_v1.process_get_pin_retries(&persistent_store),
|
||||
expected_response
|
||||
);
|
||||
}
|
||||
|
||||
@@ -265,12 +265,10 @@ impl PersistentStore {
|
||||
debug_assert_eq!(entry.tag, TAG_CREDENTIAL);
|
||||
let result = deserialize_credential(entry.data);
|
||||
debug_assert!(result.is_some());
|
||||
if check_cred_protect
|
||||
&& result.as_ref().map_or(false, |cred| {
|
||||
cred.cred_protect_policy
|
||||
== Some(CredentialProtectionPolicy::UserVerificationRequired)
|
||||
})
|
||||
{
|
||||
let user_verification_required = result.as_ref().map_or(false, |cred| {
|
||||
cred.cred_protect_policy == Some(CredentialProtectionPolicy::UserVerificationRequired)
|
||||
});
|
||||
if check_cred_protect && user_verification_required {
|
||||
Ok(None)
|
||||
} else {
|
||||
Ok(result)
|
||||
@@ -675,7 +673,6 @@ fn _serialize_min_pin_length_rp_ids(rp_ids: Vec<String>) -> Result<Vec<u8>, Ctap
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::ctap::data_formats::{PublicKeyCredentialSource, PublicKeyCredentialType};
|
||||
use crypto;
|
||||
use crypto::rng256::{Rng256, ThreadRng256};
|
||||
|
||||
fn create_credential_source(
|
||||
@@ -920,7 +917,7 @@ mod test {
|
||||
assert!(persistent_store.store_credential(credential).is_ok());
|
||||
|
||||
let no_credential = persistent_store
|
||||
.find_credential("example.com", &vec![0x00], true)
|
||||
.find_credential("example.com", &[0x00], true)
|
||||
.unwrap();
|
||||
assert_eq!(no_credential, None);
|
||||
}
|
||||
@@ -942,8 +939,8 @@ mod test {
|
||||
let master_hmac_key = master_keys_1.hmac.to_vec();
|
||||
persistent_store.reset(&mut rng).unwrap();
|
||||
let master_keys_3 = persistent_store.master_keys().unwrap();
|
||||
assert!(master_keys_3.encryption != &master_encryption_key[..]);
|
||||
assert!(master_keys_3.hmac != &master_hmac_key[..]);
|
||||
assert!(master_keys_3.encryption != master_encryption_key.as_slice());
|
||||
assert!(master_keys_3.hmac != master_hmac_key.as_slice());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user