Fix clippy warnings (#1385)

## Issue Addressed

NA

## Proposed Changes

Fixes most clippy warnings and ignores the rest of them, see issue #1388.
This commit is contained in:
blacktemplar
2020-07-23 14:18:00 +00:00
parent ba10c80633
commit 23a8f31f83
93 changed files with 396 additions and 396 deletions

View File

@@ -14,6 +14,10 @@ impl HexBytes {
pub fn len(&self) -> usize {
self.0.len()
}
pub fn is_empty(&self) -> bool {
self.0.is_empty()
}
}
impl From<Vec<u8>> for HexBytes {

View File

@@ -66,7 +66,7 @@ pub enum Prf {
impl Prf {
pub fn mac(&self, password: &[u8]) -> impl Mac {
match &self {
_hmac_sha256 => {
Prf::HmacSha256 => {
Hmac::<Sha256>::new_varkey(password).expect("Could not derive HMAC using SHA256.")
}
}

View File

@@ -409,10 +409,10 @@ fn derive_key(password: &[u8], kdf: &Kdf) -> Result<DerivedKey, Error> {
password,
params.salt.as_bytes(),
&ScryptParams::new(log2_int(params.n) as u8, params.r, params.p)
.map_err(|e| Error::ScryptInvalidParams(e))?,
.map_err(Error::ScryptInvalidParams)?,
dk.as_mut_bytes(),
)
.map_err(|e| Error::ScryptInvaidOutputLen(e))?;
.map_err(Error::ScryptInvaidOutputLen)?;
}
}