mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-13 01:51:23 +00:00
Address edition-2018 idioms. (#929)
This commit is contained in:
committed by
Pierre Krieger
parent
21810e46bd
commit
eeed66707b
@ -9,7 +9,7 @@ pub enum EncodeError {
|
||||
|
||||
impl fmt::Display for EncodeError {
|
||||
#[inline]
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match *self {
|
||||
EncodeError::UnsupportedType => write!(f, "This type is not supported yet"),
|
||||
}
|
||||
@ -29,7 +29,7 @@ pub enum DecodeError {
|
||||
|
||||
impl fmt::Display for DecodeError {
|
||||
#[inline]
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match *self {
|
||||
DecodeError::BadInputLength => write!(f, "Not matching input length"),
|
||||
DecodeError::UnknownCode => write!(f, "Found unknown code"),
|
||||
@ -52,7 +52,7 @@ pub struct DecodeOwnedError {
|
||||
|
||||
impl fmt::Display for DecodeOwnedError {
|
||||
#[inline]
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{}", self.error)
|
||||
}
|
||||
}
|
||||
|
@ -5,19 +5,11 @@
|
||||
//! A `Multihash` is a structure that contains a hashing algorithm, plus some hashed data.
|
||||
//! A `MultihashRef` is the same as a `Multihash`, except that it doesn't own its data.
|
||||
|
||||
extern crate blake2;
|
||||
extern crate rand;
|
||||
extern crate sha1;
|
||||
extern crate sha2;
|
||||
extern crate tiny_keccak;
|
||||
extern crate unsigned_varint;
|
||||
|
||||
mod errors;
|
||||
mod hashes;
|
||||
|
||||
use std::fmt::Write;
|
||||
|
||||
use sha2::Digest;
|
||||
use std::fmt::Write;
|
||||
use tiny_keccak::Keccak;
|
||||
use unsigned_varint::{decode, encode};
|
||||
|
||||
@ -169,7 +161,7 @@ impl Multihash {
|
||||
|
||||
/// Builds a `MultihashRef` corresponding to this `Multihash`.
|
||||
#[inline]
|
||||
pub fn as_ref(&self) -> MultihashRef {
|
||||
pub fn as_ref(&self) -> MultihashRef<'_> {
|
||||
MultihashRef { bytes: &self.bytes }
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user