formats code, clippy

This commit is contained in:
Fabian Kaczmarczyck
2021-01-25 18:08:48 +01:00
parent 563f35184a
commit 4f3c773b15
2 changed files with 11 additions and 4 deletions

View File

@@ -24,6 +24,7 @@ use alloc::vec::Vec;
use core::ops::Range; use core::ops::Range;
/// Represents a sequence of keys. /// Represents a sequence of keys.
#[allow(clippy::len_without_is_empty)]
pub trait Keys { pub trait Keys {
/// Returns the number of keys. /// Returns the number of keys.
fn len(&self) -> usize; fn len(&self) -> usize;

View File

@@ -31,8 +31,8 @@ use cbor::cbor_array_vec;
use core::cmp; use core::cmp;
use core::convert::TryInto; use core::convert::TryInto;
use crypto::rng256::Rng256; use crypto::rng256::Rng256;
use persistent_store::StoreUpdate;
use persistent_store::fragment::{read_range, write}; use persistent_store::fragment::{read_range, write};
use persistent_store::StoreUpdate;
// Those constants may be modified before compilation to tune the behavior of the key. // Those constants may be modified before compilation to tune the behavior of the key.
// //
@@ -492,7 +492,10 @@ impl PersistentStore {
0x7A, 0x6D, 0x3C, 0x7A, 0x6D, 0x3C,
]; ];
let last_index = cmp::min(empty_large_blob.len(), offset + byte_count); let last_index = cmp::min(empty_large_blob.len(), offset + byte_count);
empty_large_blob.get(offset..last_index).unwrap_or_default().to_vec() empty_large_blob
.get(offset..last_index)
.unwrap_or_default()
.to_vec()
})) }))
} }
@@ -505,7 +508,11 @@ impl PersistentStore {
if large_blob_array.len() > MAX_LARGE_BLOB_ARRAY_SIZE { if large_blob_array.len() > MAX_LARGE_BLOB_ARRAY_SIZE {
return Err(Ctap2StatusCode::CTAP2_ERR_VENDOR_INTERNAL_ERROR); return Err(Ctap2StatusCode::CTAP2_ERR_VENDOR_INTERNAL_ERROR);
} }
Ok(write(&mut self.store, &key::LARGE_BLOB_SHARDS, large_blob_array)?) Ok(write(
&mut self.store,
&key::LARGE_BLOB_SHARDS,
large_blob_array,
)?)
} }
/// Returns the attestation private key if defined. /// Returns the attestation private key if defined.
@@ -612,7 +619,6 @@ impl PersistentStore {
fn shard_size(&self) -> usize { fn shard_size(&self) -> usize {
self.store.max_value_length() self.store.max_value_length()
} }
} }
impl From<persistent_store::StoreError> for Ctap2StatusCode { impl From<persistent_store::StoreError> for Ctap2StatusCode {