mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-30 10:11:33 +00:00
*: 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:
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user