From 2e7e804736383c6db79df1f61eb99647f2dae26f Mon Sep 17 00:00:00 2001 From: Gary Guo Date: Thu, 25 Jun 2020 17:44:39 +0100 Subject: [PATCH] Fix unused_mut warning in nightly --- src/io/stderr.rs | 10 ++++++---- src/io/stdin.rs | 5 +++-- src/io/stdout.rs | 10 ++++++---- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/io/stderr.rs b/src/io/stderr.rs index 5067ed4..22dadd1 100644 --- a/src/io/stderr.rs +++ b/src/io/stderr.rs @@ -89,11 +89,12 @@ enum Operation { impl Write for Stderr { fn poll_write( - mut self: Pin<&mut Self>, + self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8], ) -> Poll> { - let state = &mut *self.0.lock().unwrap(); + let mut state_guard = self.0.lock().unwrap(); + let state = &mut *state_guard; loop { match state { @@ -137,8 +138,9 @@ impl Write for Stderr { } } - fn poll_flush(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { - let state = &mut *self.0.lock().unwrap(); + fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + let mut state_guard = self.0.lock().unwrap(); + let state = &mut *state_guard; loop { match state { diff --git a/src/io/stdin.rs b/src/io/stdin.rs index fc280f8..bf92bb0 100644 --- a/src/io/stdin.rs +++ b/src/io/stdin.rs @@ -149,11 +149,12 @@ impl Stdin { impl Read for Stdin { fn poll_read( - mut self: Pin<&mut Self>, + self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut [u8], ) -> Poll> { - let state = &mut *self.0.lock().unwrap(); + let mut state_guard = self.0.lock().unwrap(); + let state = &mut *state_guard; loop { match state { diff --git a/src/io/stdout.rs b/src/io/stdout.rs index b3dfe64..45244b1 100644 --- a/src/io/stdout.rs +++ b/src/io/stdout.rs @@ -89,11 +89,12 @@ enum Operation { impl Write for Stdout { fn poll_write( - mut self: Pin<&mut Self>, + self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8], ) -> Poll> { - let state = &mut *self.0.lock().unwrap(); + let mut state_guard = self.0.lock().unwrap(); + let state = &mut *state_guard; loop { match state { @@ -137,8 +138,9 @@ impl Write for Stdout { } } - fn poll_flush(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { - let state = &mut *self.0.lock().unwrap(); + fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + let mut state_guard = self.0.lock().unwrap(); + let state = &mut *state_guard; loop { match state {