From 1b999136efb8d8349d2b461e28c3f5c0c106ea4c Mon Sep 17 00:00:00 2001 From: Daniel Abramov Date: Thu, 3 Feb 2022 19:35:48 +0100 Subject: [PATCH] clippy: fix warnings --- src/protocol/frame/frame.rs | 2 +- src/protocol/frame/mask.rs | 6 +++--- src/protocol/mod.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/protocol/frame/frame.rs b/src/protocol/frame/frame.rs index 1298ebe..ce795ec 100644 --- a/src/protocol/frame/frame.rs +++ b/src/protocol/frame/frame.rs @@ -283,7 +283,7 @@ impl Frame { /// Get frame payload as `&str`. #[inline] - pub fn to_text<'a>(&'a self) -> Result<&'a str, Utf8Error> { + pub fn to_text(&self) -> Result<&str, Utf8Error> { std::str::from_utf8(&self.payload) } diff --git a/src/protocol/frame/mask.rs b/src/protocol/frame/mask.rs index 28f0eaf..31ff264 100644 --- a/src/protocol/frame/mask.rs +++ b/src/protocol/frame/mask.rs @@ -23,8 +23,8 @@ fn apply_mask_fallback(buf: &mut [u8], mask: [u8; 4]) { pub fn apply_mask_fast32(buf: &mut [u8], mask: [u8; 4]) { let mask_u32 = u32::from_ne_bytes(mask); - let (mut prefix, words, mut suffix) = unsafe { buf.align_to_mut::() }; - apply_mask_fallback(&mut prefix, mask); + let (prefix, words, suffix) = unsafe { buf.align_to_mut::() }; + apply_mask_fallback(prefix, mask); let head = prefix.len() & 3; let mask_u32 = if head > 0 { if cfg!(target_endian = "big") { @@ -38,7 +38,7 @@ pub fn apply_mask_fast32(buf: &mut [u8], mask: [u8; 4]) { for word in words.iter_mut() { *word ^= mask_u32; } - apply_mask_fallback(&mut suffix, mask_u32.to_ne_bytes()); + apply_mask_fallback(suffix, mask_u32.to_ne_bytes()); } #[cfg(test)] diff --git a/src/protocol/mod.rs b/src/protocol/mod.rs index 54b8df1..a3fa9c2 100644 --- a/src/protocol/mod.rs +++ b/src/protocol/mod.rs @@ -253,7 +253,7 @@ impl WebSocketContext { incomplete: None, send_queue: VecDeque::new(), pong: None, - config: config.unwrap_or_else(WebSocketConfig::default), + config: config.unwrap_or_default(), } }