Fix most Clippy warnings.
This commit is contained in:
@@ -554,6 +554,7 @@ impl Add for &Int256 {
|
||||
type Output = (Int256, Digit);
|
||||
|
||||
// Returns sum and carry (0 or 1).
|
||||
#[allow(clippy::suspicious_arithmetic_impl)]
|
||||
fn add(self, other: &Int256) -> (Int256, Digit) {
|
||||
let mut digits = [0; NDIGITS];
|
||||
let mut carry: DoubleDigit = 0;
|
||||
@@ -570,6 +571,7 @@ impl Add for &Int256 {
|
||||
|
||||
impl AddAssign<&Int256> for Int256 {
|
||||
// Adds to self, ignoring carry.
|
||||
#[allow(clippy::suspicious_op_assign_impl)]
|
||||
fn add_assign(&mut self, other: &Int256) {
|
||||
let mut carry: DoubleDigit = 0;
|
||||
for i in 0..NDIGITS {
|
||||
@@ -584,6 +586,7 @@ impl Add<Digit> for &Int256 {
|
||||
type Output = (Int256, Digit);
|
||||
|
||||
// Returns sum and carry (0 or 1).
|
||||
#[allow(clippy::suspicious_arithmetic_impl)]
|
||||
fn add(self, digit: Digit) -> (Int256, Digit) {
|
||||
let mut digits = [0; NDIGITS];
|
||||
let mut carry = digit as DoubleDigit;
|
||||
@@ -603,6 +606,7 @@ impl Sub for &Int256 {
|
||||
type Output = (Int256, Digit);
|
||||
|
||||
// Returns difference and borrow (0 or -1).
|
||||
#[allow(clippy::suspicious_arithmetic_impl)]
|
||||
fn sub(self, other: &Int256) -> (Int256, Digit) {
|
||||
let mut digits = [0; NDIGITS];
|
||||
let mut borrow: SignedDoubleDigit = 0;
|
||||
@@ -620,6 +624,7 @@ impl Sub for &Int256 {
|
||||
|
||||
impl SubAssign<&Int256> for Int256 {
|
||||
// Substract from self, ignoring carry.
|
||||
#[allow(clippy::suspicious_op_assign_impl)]
|
||||
fn sub_assign(&mut self, other: &Int256) {
|
||||
let mut borrow: SignedDoubleDigit = 0;
|
||||
for i in 0..NDIGITS {
|
||||
|
||||
@@ -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()?;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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> {
|
||||
|
||||
1
third_party/lang-items/src/allocator.rs
vendored
1
third_party/lang-items/src/allocator.rs
vendored
@@ -44,6 +44,7 @@ impl TockAllocator {
|
||||
}
|
||||
|
||||
unsafe impl GlobalAlloc for TockAllocator {
|
||||
#[allow(clippy::let_and_return)]
|
||||
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
|
||||
let ptr = HEAP
|
||||
.allocate_first_fit(layout)
|
||||
|
||||
1
third_party/libtock-drivers/src/console.rs
vendored
1
third_party/libtock-drivers/src/console.rs
vendored
@@ -25,6 +25,7 @@ pub struct Console {
|
||||
}
|
||||
|
||||
impl Console {
|
||||
#[allow(clippy::new_without_default)]
|
||||
pub fn new() -> Console {
|
||||
Console {
|
||||
allow_buffer: [0; BUFFER_SIZE],
|
||||
|
||||
2
third_party/libtock-drivers/src/rng.rs
vendored
2
third_party/libtock-drivers/src/rng.rs
vendored
@@ -41,5 +41,5 @@ pub fn fill_buffer(buf: &mut [u8]) -> bool {
|
||||
}
|
||||
|
||||
util::yieldk_for(|| is_filled.get());
|
||||
return true;
|
||||
true
|
||||
}
|
||||
|
||||
@@ -173,6 +173,7 @@ pub fn send_or_recv(buf: &mut [u8; 64]) -> SendOrRecvStatus {
|
||||
|
||||
// Same as recv, but with a timeout.
|
||||
// If the timeout elapses, return None.
|
||||
#[allow(clippy::let_and_return)]
|
||||
pub fn recv_with_timeout(
|
||||
buf: &mut [u8; 64],
|
||||
timeout_delay: Duration<isize>,
|
||||
@@ -199,6 +200,7 @@ pub fn recv_with_timeout(
|
||||
|
||||
// Same as send_or_recv, but with a timeout.
|
||||
// If the timeout elapses, return None.
|
||||
#[allow(clippy::let_and_return)]
|
||||
pub fn send_or_recv_with_timeout(
|
||||
buf: &mut [u8; 64],
|
||||
timeout_delay: Duration<isize>,
|
||||
|
||||
Reference in New Issue
Block a user