Skip to content

Commit

Permalink
chore(lib): fix new unused_mut warnings in nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmonstar committed Aug 11, 2017
1 parent f2db365 commit 2ea125e
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/header/common/authorization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/header/common/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
4 changes: 2 additions & 2 deletions src/header/internals/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl<V: ?Sized + Any + 'static> PtrMapCell<V> {

#[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 {
Expand Down Expand Up @@ -107,7 +107,7 @@ impl<V: ?Sized + Any + 'static> PtrMapCell<V> {

#[inline]
pub unsafe fn insert(&self, key: TypeId, val: Box<V>) {
let mut map = &mut *self.0.get();
let map = &mut *self.0.get();
match *map {
PtrMap::Empty => *map = PtrMap::One(key, val),
PtrMap::One(..) => {
Expand Down
2 changes: 1 addition & 1 deletion src/http/conn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/http/h1/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/http/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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));
Expand Down

0 comments on commit 2ea125e

Please sign in to comment.