*: Apply clippy suggestions and enable clippy on CI (#1850)

* *: Apply clippy suggestions

* .github: Add clippy check

* protocols/kad/record: Implement custom PartialEq for ProviderRecord
This commit is contained in:
Max Inden
2020-11-24 15:59:22 +01:00
committed by GitHub
parent 5e21806a38
commit e3af8b7d03
22 changed files with 108 additions and 111 deletions

View File

@ -74,7 +74,7 @@ impl PreSharedKey {
cipher.apply_keystream(&mut enc);
let mut hasher = Shake128::default();
hasher.write_all(&enc).expect("shake128 failed");
hasher.finalize_xof().read(&mut out).expect("shake128 failed");
hasher.finalize_xof().read_exact(&mut out).expect("shake128 failed");
Fingerprint(out)
}
}
@ -109,7 +109,7 @@ impl FromStr for PreSharedKey {
type Err = KeyParseError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
if let &[keytype, encoding, key] = s.lines().take(3).collect::<Vec<_>>().as_slice() {
if let [keytype, encoding, key] = *s.lines().take(3).collect::<Vec<_>>().as_slice() {
if keytype != "/key/swarm/psk/1.0.0/" {
return Err(KeyParseError::InvalidKeyType);
}