From 2ea125e609512a44e22ccb42d18b43f8a7ae0e08 Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Fri, 11 Aug 2017 15:07:49 -0700 Subject: [PATCH] chore(lib): fix new unused_mut warnings in nightly --- src/header/common/authorization.rs | 2 +- src/header/common/link.rs | 2 +- src/header/internals/cell.rs | 4 ++-- src/http/conn.rs | 2 +- src/http/h1/decode.rs | 4 ++-- src/http/io.rs | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/header/common/authorization.rs b/src/header/common/authorization.rs index 98249bac1e..68c24c0264 100644 --- a/src/header/common/authorization.rs +++ b/src/header/common/authorization.rs @@ -170,7 +170,7 @@ impl FromStr for Basic { match decode(s) { Ok(decoded) => match String::from_utf8(decoded) { Ok(text) => { - let mut parts = &mut text.split(':'); + let parts = &mut text.split(':'); let user = match parts.next() { Some(part) => part.to_owned(), None => return Err(::Error::Header) diff --git a/src/header/common/link.rs b/src/header/common/link.rs index 04783ba44a..0395801fce 100644 --- a/src/header/common/link.rs +++ b/src/header/common/link.rs @@ -495,7 +495,7 @@ impl FromStr for Link { Some(p) => p.trim(), }; - let mut link_header = match link_values.last_mut() { + let link_header = match link_values.last_mut() { None => return Err(::Error::Header), Some(l) => l, }; diff --git a/src/header/internals/cell.rs b/src/header/internals/cell.rs index 21ded572b1..daf116a0df 100644 --- a/src/header/internals/cell.rs +++ b/src/header/internals/cell.rs @@ -79,7 +79,7 @@ impl PtrMapCell { #[inline] pub fn get_mut(&mut self, key: TypeId) -> Option<&mut V> { - let mut map = unsafe { &mut *self.0.get() }; + let map = unsafe { &mut *self.0.get() }; match *map { PtrMap::Empty => None, PtrMap::One(id, ref mut v) => if id == key { @@ -107,7 +107,7 @@ impl PtrMapCell { #[inline] pub unsafe fn insert(&self, key: TypeId, val: Box) { - let mut map = &mut *self.0.get(); + let map = &mut *self.0.get(); match *map { PtrMap::Empty => *map = PtrMap::One(key, val), PtrMap::One(..) => { diff --git a/src/http/conn.rs b/src/http/conn.rs index b86feb8e80..608f72118e 100644 --- a/src/http/conn.rs +++ b/src/http/conn.rs @@ -240,7 +240,7 @@ where I: AsyncRead + AsyncWrite, let wants_keep_alive = head.should_keep_alive(); self.state.keep_alive &= wants_keep_alive; - let mut buf = self.io.write_buf_mut(); + let buf = self.io.write_buf_mut(); // if a 100-continue has started but not finished sending, tack the // remainder on to the start of the buffer. if let Writing::Continue(ref pending) = self.state.writing { diff --git a/src/http/h1/decode.rs b/src/http/h1/decode.rs index 609e50766f..11438239c5 100644 --- a/src/http/h1/decode.rs +++ b/src/http/h1/decode.rs @@ -326,7 +326,7 @@ mod tests { fn read(s: &str) -> u64 { let mut state = ChunkedState::Size; - let mut rdr = &mut s.as_bytes(); + let rdr = &mut s.as_bytes(); let mut size = 0; loop { let result = state.step(rdr, &mut size, &mut None); @@ -341,7 +341,7 @@ mod tests { fn read_err(s: &str, expected_err: io::ErrorKind) { let mut state = ChunkedState::Size; - let mut rdr = &mut s.as_bytes(); + let rdr = &mut s.as_bytes(); let mut size = 0; loop { let result = state.step(rdr, &mut size, &mut None); diff --git a/src/http/io.rs b/src/http/io.rs index 88c054e6a9..971a3e840d 100644 --- a/src/http/io.rs +++ b/src/http/io.rs @@ -275,7 +275,7 @@ impl WriteBuf { trace!("WriteBuf::buffer() len = {:?}", data.len()); self.maybe_reset(); self.maybe_reserve(data.len()); - let mut vec = &mut self.0.bytes; + let vec = &mut self.0.bytes; let len = cmp::min(vec.capacity() - vec.len(), data.len()); assert!(vec.capacity() - vec.len() >= len); unsafe { @@ -297,7 +297,7 @@ impl WriteBuf { #[inline] fn maybe_reserve(&mut self, needed: usize) { - let mut vec = &mut self.0.bytes; + let vec = &mut self.0.bytes; let cap = vec.capacity(); if cap == 0 { let init = cmp::min(MAX_BUFFER_SIZE, cmp::max(INIT_BUFFER_SIZE, needed));