diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9fec5837e3c..4e07f18c049 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -267,8 +267,6 @@ jobs: - name: Install Rust run: rustup update stable - uses: Swatinem/rust-cache@v1 - - name: Install rustfmt - run: rustup component add rustfmt # Check fmt - name: "rustfmt --check" @@ -285,7 +283,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Install Rust - run: rustup update 1.52.1 && rustup default 1.52.1 + run: rustup update 1.56 && rustup default 1.56 - uses: Swatinem/rust-cache@v1 - name: Install clippy run: rustup component add clippy diff --git a/benches/fs.rs b/benches/fs.rs index 305668f9a54..026814ff468 100644 --- a/benches/fs.rs +++ b/benches/fs.rs @@ -21,7 +21,7 @@ fn rt() -> tokio::runtime::Runtime { const BLOCK_COUNT: usize = 1_000; const BUFFER_SIZE: usize = 4096; -const DEV_ZERO: &'static str = "/dev/zero"; +const DEV_ZERO: &str = "/dev/zero"; fn async_read_codec(b: &mut Bencher) { let rt = rt(); diff --git a/examples/tinydb.rs b/examples/tinydb.rs index 9da429ace69..5a1983df6b4 100644 --- a/examples/tinydb.rs +++ b/examples/tinydb.rs @@ -149,7 +149,7 @@ async fn main() -> Result<(), Box> { } fn handle_request(line: &str, db: &Arc) -> Response { - let request = match Request::parse(&line) { + let request = match Request::parse(line) { Ok(req) => req, Err(e) => return Response::Error { msg: e }, }; diff --git a/tokio-stream/src/stream_ext/collect.rs b/tokio-stream/src/stream_ext/collect.rs index a33a6d6692a..4b157a9aacc 100644 --- a/tokio-stream/src/stream_ext/collect.rs +++ b/tokio-stream/src/stream_ext/collect.rs @@ -66,17 +66,17 @@ where use Poll::Ready; loop { - let mut me = self.as_mut().project(); + let me = self.as_mut().project(); let item = match ready!(me.stream.poll_next(cx)) { Some(item) => item, None => { - return Ready(U::finalize(sealed::Internal, &mut me.collection)); + return Ready(U::finalize(sealed::Internal, me.collection)); } }; - if !U::extend(sealed::Internal, &mut me.collection, item) { - return Ready(U::finalize(sealed::Internal, &mut me.collection)); + if !U::extend(sealed::Internal, me.collection, item) { + return Ready(U::finalize(sealed::Internal, me.collection)); } } } diff --git a/tokio/src/io/async_fd.rs b/tokio/src/io/async_fd.rs index 9ec5b7f2387..e352843398a 100644 --- a/tokio/src/io/async_fd.rs +++ b/tokio/src/io/async_fd.rs @@ -598,7 +598,7 @@ impl<'a, Inner: AsRawFd> AsyncFdReadyMutGuard<'a, Inner> { &mut self, f: impl FnOnce(&mut AsyncFd) -> io::Result, ) -> Result, TryIoError> { - let result = f(&mut self.async_fd); + let result = f(self.async_fd); if let Err(e) = result.as_ref() { if e.kind() == io::ErrorKind::WouldBlock { diff --git a/tokio/src/io/util/buf_reader.rs b/tokio/src/io/util/buf_reader.rs index 7df610b143a..60879c0fdc2 100644 --- a/tokio/src/io/util/buf_reader.rs +++ b/tokio/src/io/util/buf_reader.rs @@ -204,7 +204,6 @@ impl AsyncSeek for BufReader { self.as_mut() .get_pin_mut() .start_seek(SeekFrom::Current(offset))?; - self.as_mut().get_pin_mut().poll_complete(cx)? } else { // seek backwards by our remainder, and then by the offset self.as_mut() @@ -221,8 +220,8 @@ impl AsyncSeek for BufReader { self.as_mut() .get_pin_mut() .start_seek(SeekFrom::Current(n))?; - self.as_mut().get_pin_mut().poll_complete(cx)? } + self.as_mut().get_pin_mut().poll_complete(cx)? } SeekState::PendingOverflowed(n) => { if self.as_mut().get_pin_mut().poll_complete(cx)?.is_pending() { diff --git a/tokio/src/io/util/read_exact.rs b/tokio/src/io/util/read_exact.rs index 1e8150eb20f..dbdd58bae99 100644 --- a/tokio/src/io/util/read_exact.rs +++ b/tokio/src/io/util/read_exact.rs @@ -51,13 +51,13 @@ where type Output = io::Result; fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { - let mut me = self.project(); + let me = self.project(); loop { // if our buffer is empty, then we need to read some data to continue. let rem = me.buf.remaining(); if rem != 0 { - ready!(Pin::new(&mut *me.reader).poll_read(cx, &mut me.buf))?; + ready!(Pin::new(&mut *me.reader).poll_read(cx, me.buf))?; if me.buf.remaining() == rem { return Err(eof()).into(); } diff --git a/tokio/src/task/task_local.rs b/tokio/src/task/task_local.rs index b6e7df43e18..949bbca3eee 100644 --- a/tokio/src/task/task_local.rs +++ b/tokio/src/task/task_local.rs @@ -258,14 +258,14 @@ impl TaskLocalFuture { } } - let mut project = self.project(); + let project = self.project(); let val = project.slot.take(); let prev = project.local.inner.with(|c| c.replace(val)); let _guard = Guard { prev, - slot: &mut project.slot, + slot: project.slot, local: *project.local, }; diff --git a/tokio/src/task/yield_now.rs b/tokio/src/task/yield_now.rs index 5eeb46a8983..148e3dc0c87 100644 --- a/tokio/src/task/yield_now.rs +++ b/tokio/src/task/yield_now.rs @@ -33,7 +33,6 @@ use std::task::{Context, Poll}; /// which order the runtime polls your tasks in. /// /// [`tokio::select!`]: macro@crate::select -#[must_use = "yield_now does nothing unless polled/`await`-ed"] #[cfg_attr(docsrs, doc(cfg(feature = "rt")))] pub async fn yield_now() { /// Yield implementation diff --git a/tokio/src/time/driver/wheel/level.rs b/tokio/src/time/driver/wheel/level.rs index 34d31766ce1..7fd2266bb8e 100644 --- a/tokio/src/time/driver/wheel/level.rs +++ b/tokio/src/time/driver/wheel/level.rs @@ -53,7 +53,7 @@ impl Level { // However, that is only supported for arrays of size // 32 or fewer. So in our case we have to explicitly // invoke the constructor for each array element. - let ctor = || EntryList::default(); + let ctor = EntryList::default; Level { level,