mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-25 15:51:34 +00:00
Address edition-2018 idioms. (#929)
This commit is contained in:
committed by
Pierre Krieger
parent
21810e46bd
commit
eeed66707b
@ -35,7 +35,7 @@ pub enum NoiseError {
|
||||
}
|
||||
|
||||
impl fmt::Display for NoiseError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
NoiseError::Io(e) => write!(f, "{}", e),
|
||||
NoiseError::Noise(e) => write!(f, "{}", e),
|
||||
|
@ -44,7 +44,7 @@ struct BufferBorrow<'a> {
|
||||
|
||||
impl Buffer {
|
||||
/// Create a mutable borrow by splitting the buffer slice.
|
||||
fn borrow_mut(&mut self) -> BufferBorrow {
|
||||
fn borrow_mut(&mut self) -> BufferBorrow<'_> {
|
||||
let (r, w) = self.inner.split_at_mut(2 * MAX_NOISE_PKG_LEN);
|
||||
let (read, read_crypto) = r.split_at_mut(MAX_NOISE_PKG_LEN);
|
||||
let (write, write_crypto) = w.split_at_mut(MAX_WRITE_BUF_LEN);
|
||||
@ -101,7 +101,7 @@ pub struct NoiseOutput<T> {
|
||||
}
|
||||
|
||||
impl<T> fmt::Debug for NoiseOutput<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("NoiseOutput")
|
||||
.field("read_state", &self.read_state)
|
||||
.field("write_state", &self.write_state)
|
||||
|
@ -108,7 +108,7 @@ impl snow::types::Dh for X25519 {
|
||||
self.keypair = Keypair::new(secret, public)
|
||||
}
|
||||
|
||||
fn generate(&mut self, rng: &mut snow::types::Random) {
|
||||
fn generate(&mut self, rng: &mut dyn snow::types::Random) {
|
||||
let mut s = [0; 32];
|
||||
rng.fill_bytes(&mut s);
|
||||
let secret = SecretKey::new(s);
|
||||
|
Reference in New Issue
Block a user