mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-30 02:01:35 +00:00
*: Fix clippy warnings (#2139)
* Fix needless question mark operator * Don't convert from u64 to u64 LocalStreamId is already a u64, no need to convert. * Don't use `.into()` to convert to the same type * Don't specify lifetime if it can be inferred * Use `vec!` macro if we immediately push to it This creates the vector with the appropriate capacity. * Don't index array when taking a reference is enough Co-authored-by: Max Inden <mail@max-inden.de>
This commit is contained in:
@ -68,8 +68,8 @@ impl PeerId {
|
||||
|
||||
/// Parses a `PeerId` from bytes.
|
||||
pub fn from_bytes(data: &[u8]) -> Result<PeerId, Error> {
|
||||
Ok(PeerId::from_multihash(Multihash::from_bytes(&data)?)
|
||||
.map_err(|mh| Error::UnsupportedCode(mh.code()))?)
|
||||
PeerId::from_multihash(Multihash::from_bytes(&data)?)
|
||||
.map_err(|mh| Error::UnsupportedCode(mh.code()))
|
||||
}
|
||||
|
||||
/// Tries to turn a `Multihash` into a `PeerId`.
|
||||
|
Reference in New Issue
Block a user