From 7de32d86d0079b2f57f5f4e20a802e7e50af8a2d Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Sat, 3 Aug 2019 13:56:45 +0900 Subject: [PATCH 1/6] chore: bump to newer nightly --- .cirrus.yml | 2 +- azure-pipelines.yml | 2 +- rust-toolchain | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index e78c2d015d2..976f923ae0c 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -13,7 +13,7 @@ task: - pkg install -y curl - curl https://sh.rustup.rs -sSf --output rustup.sh # TODO: switch back to nightly - - sh rustup.sh -y --default-toolchain nightly-2019-07-17 + - sh rustup.sh -y --default-toolchain nightly-2019-08-10 - . $HOME/.cargo/env - rustup target add i686-unknown-freebsd - | diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6e945985703..ecdd26d71c8 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -2,7 +2,7 @@ trigger: ["master", "std-future"] pr: ["master", "std-future"] variables: - nightly: nightly-2019-07-17 + nightly: nightly-2019-08-10 RUSTFLAGS: -Dwarnings jobs: diff --git a/rust-toolchain b/rust-toolchain index fead76e739c..54dbba0da74 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2019-07-17 \ No newline at end of file +nightly-2019-08-10 From 24a9d9cd0c682970c64a26a5d80f3ff0e184e629 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Sat, 3 Aug 2019 14:15:25 +0900 Subject: [PATCH 2/6] remove unstable await_macro feature `await_macro` feature has been removed in https://github.com/rust-lang/rust/pull/62293. --- tokio-executor/tests/enter.rs | 2 +- tokio-executor/tests/executor.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tokio-executor/tests/enter.rs b/tokio-executor/tests/enter.rs index 25ef600694f..fd13bd12133 100644 --- a/tokio-executor/tests/enter.rs +++ b/tokio-executor/tests/enter.rs @@ -1,5 +1,5 @@ #![warn(rust_2018_idioms)] -#![feature(await_macro, async_await)] +#![feature(async_await)] #[test] fn block_on_ready() { diff --git a/tokio-executor/tests/executor.rs b/tokio-executor/tests/executor.rs index 608db157885..fb039385519 100644 --- a/tokio-executor/tests/executor.rs +++ b/tokio-executor/tests/executor.rs @@ -1,5 +1,5 @@ #![warn(rust_2018_idioms)] -#![feature(await_macro, async_await)] +#![feature(async_await)] use tokio_executor::{self, DefaultExecutor}; From da2904db9ee81b5e0a28c8b7a4f114db74b0aca2 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Sat, 3 Aug 2019 14:21:56 +0900 Subject: [PATCH 3/6] remove allow(clippy::needless_lifetimes) This false positive has been fixed in https://github.com/rust-lang/rust-clippy/pull/4266. --- tokio-fs/src/file.rs | 7 ------- tokio-fs/src/open_options.rs | 1 - tokio-fs/src/read_dir.rs | 2 -- tokio-sync/src/lock.rs | 1 - tokio-sync/src/mpsc/bounded.rs | 2 -- tokio-sync/src/mpsc/unbounded.rs | 1 - tokio-sync/src/oneshot.rs | 1 - tokio-sync/src/watch.rs | 2 -- tokio-tcp/src/listener.rs | 1 - tokio-timer/src/interval.rs | 1 - tokio-tls/src/lib.rs | 1 - tokio-uds/src/listener.rs | 2 +- 12 files changed, 1 insertion(+), 21 deletions(-) diff --git a/tokio-fs/src/file.rs b/tokio-fs/src/file.rs index ca1e14a0f3f..43b927ec5e0 100644 --- a/tokio-fs/src/file.rs +++ b/tokio-fs/src/file.rs @@ -184,7 +184,6 @@ impl File { /// # Ok(()) /// # } /// ``` - #[allow(clippy::needless_lifetimes)] // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 pub async fn seek(&mut self, pos: io::SeekFrom) -> io::Result { asyncify(|| self.std.seek(pos)).await } @@ -209,7 +208,6 @@ impl File { /// # Ok(()) /// # } /// ``` - #[allow(clippy::needless_lifetimes)] // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 pub async fn sync_all(&mut self) -> io::Result<()> { asyncify(|| self.std.sync_all()).await } @@ -238,7 +236,6 @@ impl File { /// # Ok(()) /// # } /// ``` - #[allow(clippy::needless_lifetimes)] // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 pub async fn sync_data(&mut self) -> io::Result<()> { asyncify(|| self.std.sync_data()).await } @@ -270,7 +267,6 @@ impl File { /// # Ok(()) /// # } /// ``` - #[allow(clippy::needless_lifetimes)] // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 pub async fn set_len(&mut self, size: u64) -> io::Result<()> { asyncify(|| self.std.set_len(size)).await } @@ -292,7 +288,6 @@ impl File { /// # Ok(()) /// # } /// ``` - #[allow(clippy::needless_lifetimes)] // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 pub async fn metadata(&self) -> io::Result { asyncify(|| self.std.metadata()).await } @@ -314,7 +309,6 @@ impl File { /// # Ok(()) /// # } /// ``` - #[allow(clippy::needless_lifetimes)] // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 pub async fn try_clone(&self) -> io::Result { let std_file = asyncify(|| self.std.try_clone()).await?; Ok(File::from_std(std_file)) @@ -351,7 +345,6 @@ impl File { /// # Ok(()) /// # } /// ``` - #[allow(clippy::needless_lifetimes)] // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 pub async fn set_permissions(&self, perm: Permissions) -> io::Result<()> { asyncify(|| self.std.set_permissions(perm)).await } diff --git a/tokio-fs/src/open_options.rs b/tokio-fs/src/open_options.rs index ff979772d05..85b6f1db561 100644 --- a/tokio-fs/src/open_options.rs +++ b/tokio-fs/src/open_options.rs @@ -89,7 +89,6 @@ impl OpenOptions { /// Tokio runtime or if the underlying [`open`] call results in an error. /// /// [`open`]: https://doc.rust-lang.org/std/fs/struct.OpenOptions.html#method.open - #[allow(clippy::needless_lifetimes)] // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 pub async fn open

(&self, path: P) -> io::Result where P: AsRef + Send + Unpin + 'static, diff --git a/tokio-fs/src/read_dir.rs b/tokio-fs/src/read_dir.rs index 33209e7524b..f3f12ace07b 100644 --- a/tokio-fs/src/read_dir.rs +++ b/tokio-fs/src/read_dir.rs @@ -182,7 +182,6 @@ impl DirEntry { /// # Ok(()) /// # } /// ``` - #[allow(clippy::needless_lifetimes)] // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 pub async fn metadata(&self) -> io::Result { asyncify(|| self.0.metadata()).await } @@ -222,7 +221,6 @@ impl DirEntry { /// # Ok(()) /// # } /// ``` - #[allow(clippy::needless_lifetimes)] // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 pub async fn file_type(&self) -> io::Result { asyncify(|| self.0.file_type()).await } diff --git a/tokio-sync/src/lock.rs b/tokio-sync/src/lock.rs index addef25f220..2c31dae324f 100644 --- a/tokio-sync/src/lock.rs +++ b/tokio-sync/src/lock.rs @@ -111,7 +111,6 @@ impl Lock { } /// A future that resolves on acquiring the lock and returns the `LockGuard`. - #[allow(clippy::needless_lifetimes)] // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 pub async fn lock(&mut self) -> LockGuard { poll_fn(|cx| self.poll_lock(cx)).await } diff --git a/tokio-sync/src/mpsc/bounded.rs b/tokio-sync/src/mpsc/bounded.rs index 6c3a2fdea5d..4f6f1ac6021 100644 --- a/tokio-sync/src/mpsc/bounded.rs +++ b/tokio-sync/src/mpsc/bounded.rs @@ -167,7 +167,6 @@ impl Receiver { /// assert_eq!(Some("world"), rx.recv().await); /// } /// ``` - #[allow(clippy::needless_lifetimes)] // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 pub async fn recv(&mut self) -> Option { use futures_util::future::poll_fn; @@ -244,7 +243,6 @@ impl Sender { /// } /// } /// ``` - #[allow(clippy::needless_lifetimes)] // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 pub async fn send(&mut self, value: T) -> Result<(), SendError> { use futures_util::future::poll_fn; diff --git a/tokio-sync/src/mpsc/unbounded.rs b/tokio-sync/src/mpsc/unbounded.rs index 60694f15e0c..2760b845ce1 100644 --- a/tokio-sync/src/mpsc/unbounded.rs +++ b/tokio-sync/src/mpsc/unbounded.rs @@ -135,7 +135,6 @@ impl UnboundedReceiver { /// assert_eq!(Some("world"), rx.recv().await); /// } /// ``` - #[allow(clippy::needless_lifetimes)] // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 pub async fn recv(&mut self) -> Option { use futures_util::future::poll_fn; diff --git a/tokio-sync/src/oneshot.rs b/tokio-sync/src/oneshot.rs index 7130118c8d2..50176b3d8dd 100644 --- a/tokio-sync/src/oneshot.rs +++ b/tokio-sync/src/oneshot.rs @@ -225,7 +225,6 @@ impl Sender { /// println!("the receiver dropped"); /// } /// ``` - #[allow(clippy::needless_lifetimes)] // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 pub async fn closed(&mut self) { use futures_util::future::poll_fn; diff --git a/tokio-sync/src/watch.rs b/tokio-sync/src/watch.rs index 4fec6947336..4312c153bf9 100644 --- a/tokio-sync/src/watch.rs +++ b/tokio-sync/src/watch.rs @@ -249,7 +249,6 @@ impl Receiver { /// /// Only the **most recent** value is returned. If the receiver is falling /// behind the sender, intermediate values are dropped. - #[allow(clippy::needless_lifetimes)] // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 pub async fn recv_ref<'a>(&'a mut self) -> Option> { let shared = &self.shared; let inner = &self.inner; @@ -388,7 +387,6 @@ impl Sender { /// /// This allows the producer to get notified when interest in the produced /// values is canceled and immediately stop doing work. - #[allow(clippy::needless_lifetimes)] // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 pub async fn closed(&mut self) { poll_fn(|cx| self.poll_close(cx)).await } diff --git a/tokio-tcp/src/listener.rs b/tokio-tcp/src/listener.rs index bd63d09165c..44476977d2a 100644 --- a/tokio-tcp/src/listener.rs +++ b/tokio-tcp/src/listener.rs @@ -86,7 +86,6 @@ impl TcpListener { /// # Ok(()) /// # } /// ``` - #[allow(clippy::needless_lifetimes)] // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 pub async fn accept(&mut self) -> io::Result<(TcpStream, SocketAddr)> { poll_fn(|cx| self.poll_accept(cx)).await } diff --git a/tokio-timer/src/interval.rs b/tokio-timer/src/interval.rs index 3b480f444c7..31e003f21bf 100644 --- a/tokio-timer/src/interval.rs +++ b/tokio-timer/src/interval.rs @@ -94,7 +94,6 @@ impl Interval { /// // approximately 30ms have elapsed. /// } /// ``` - #[allow(clippy::needless_lifetimes)] // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 #[allow(clippy::should_implement_trait)] // TODO: rename (tokio-rs/tokio#1261) pub async fn next(&mut self) -> Option { poll_fn(|cx| self.poll_next(cx)).await diff --git a/tokio-tls/src/lib.rs b/tokio-tls/src/lib.rs index 515935c7c9e..afc30fb18e2 100644 --- a/tokio-tls/src/lib.rs +++ b/tokio-tls/src/lib.rs @@ -287,7 +287,6 @@ impl TlsAcceptor { /// This is typically used after a new socket has been accepted from a /// `TcpListener`. That socket is then passed to this function to perform /// the server half of accepting a client connection. - #[allow(clippy::needless_lifetimes)] // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 pub async fn accept(&self, stream: S) -> Result, Error> where S: AsyncRead + AsyncWrite + Unpin, diff --git a/tokio-uds/src/listener.rs b/tokio-uds/src/listener.rs index 9e9f7c2ab72..917c157588f 100644 --- a/tokio-uds/src/listener.rs +++ b/tokio-uds/src/listener.rs @@ -52,7 +52,7 @@ impl UnixListener { } /// Accepts a new incoming connection to this listener. - #[allow(clippy::needless_lifetimes)] // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 + // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 pub async fn accept(&mut self) -> io::Result<(UnixStream, SocketAddr)> { poll_fn(|cx| self.poll_accept(cx)).await } From e362e8e07d3b19ada8bc89d8bd89440b13877aa8 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Sat, 3 Aug 2019 14:37:20 +0900 Subject: [PATCH 4/6] elide lifetimes Lifetime elision in `Pin<&(mut) Self>` has been allowed in https://github.com/rust-lang/rust/pull/61207. --- tokio-codec/src/framed.rs | 5 +--- tokio-codec/src/framed_write.rs | 5 +--- tokio-codec/tests/framed_read.rs | 2 +- tokio-current-thread/src/lib.rs | 10 ++++---- tokio-current-thread/src/scheduler.rs | 4 ++-- tokio-current-thread/tests/current_thread.rs | 2 -- tokio-executor/src/global.rs | 2 +- tokio-io/src/async_buf_read.rs | 24 +++++--------------- tokio-io/src/io/copy.rs | 2 +- tokio-io/src/io/flush.rs | 2 +- tokio-io/src/io/read.rs | 2 +- tokio-io/src/io/read_exact.rs | 2 +- tokio-io/src/io/shutdown.rs | 2 +- tokio-io/src/io/write.rs | 2 +- tokio-process/src/kill.rs | 2 +- tokio-process/src/unix/orphan.rs | 4 ++-- tokio-signal/examples/multiple.rs | 1 - tokio-sync/src/task/atomic_waker.rs | 2 +- tokio-sync/src/watch.rs | 4 ++-- tokio-sync/tests/fuzz_oneshot.rs | 2 +- tokio-threadpool/src/sender.rs | 2 +- tokio-threadpool/src/task/mod.rs | 2 +- tokio-threadpool/src/worker/mod.rs | 2 +- tokio-threadpool/tests/threadpool.rs | 2 +- tokio-timer/src/clock/mod.rs | 2 +- tokio-tls/src/lib.rs | 2 +- tokio-udp/src/split.rs | 2 +- tokio-uds/src/listener.rs | 2 +- tokio/examples/tinyhttp.rs | 4 ++-- 29 files changed, 40 insertions(+), 61 deletions(-) diff --git a/tokio-codec/src/framed.rs b/tokio-codec/src/framed.rs index 707353dbc6d..da131ee152b 100644 --- a/tokio-codec/src/framed.rs +++ b/tokio-codec/src/framed.rs @@ -234,10 +234,7 @@ impl AsyncRead for Fuse { } impl AsyncBufRead for Fuse { - fn poll_fill_buf<'a>( - self: Pin<&'a mut Self>, - cx: &mut Context<'_>, - ) -> Poll> { + fn poll_fill_buf(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { pin!(self.get_mut().0).poll_fill_buf(cx) } diff --git a/tokio-codec/src/framed_write.rs b/tokio-codec/src/framed_write.rs index 34d246065a9..0ea45b5cc9f 100644 --- a/tokio-codec/src/framed_write.rs +++ b/tokio-codec/src/framed_write.rs @@ -280,10 +280,7 @@ impl AsyncRead for FramedWrite2 { } impl AsyncBufRead for FramedWrite2 { - fn poll_fill_buf<'a>( - self: Pin<&'a mut Self>, - cx: &mut Context<'_>, - ) -> Poll> { + fn poll_fill_buf(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { pin!(self.get_mut().inner).poll_fill_buf(cx) } diff --git a/tokio-codec/tests/framed_read.rs b/tokio-codec/tests/framed_read.rs index 4215c04cb5a..dc36d8b9025 100644 --- a/tokio-codec/tests/framed_read.rs +++ b/tokio-codec/tests/framed_read.rs @@ -284,7 +284,7 @@ impl AsyncRead for Mock { // TODO this newtype is necessary because `&[u8]` does not currently implement `AsyncRead` struct Slice<'a>(&'a [u8]); -impl<'a> AsyncRead for Slice<'a> { +impl AsyncRead for Slice<'_> { fn poll_read( mut self: Pin<&mut Self>, cx: &mut Context<'_>, diff --git a/tokio-current-thread/src/lib.rs b/tokio-current-thread/src/lib.rs index 483b1fd0765..f22fb70e489 100644 --- a/tokio-current-thread/src/lib.rs +++ b/tokio-current-thread/src/lib.rs @@ -429,7 +429,7 @@ impl Default for CurrentThread

{ // ===== impl Entered ===== -impl<'a, P: Park> Entered<'a, P> { +impl Entered<'_, P> { /// Spawn the future on the executor. /// /// This internally queues the future to be executed once `run` is called. @@ -593,7 +593,7 @@ impl<'a, P: Park> Entered<'a, P> { } } -impl<'a, P: Park> fmt::Debug for Entered<'a, P> { +impl fmt::Debug for Entered<'_, P> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.debug_struct("Entered") .field("executor", &self.executor) @@ -738,7 +738,7 @@ where // ===== impl Borrow ===== -impl<'a, U: Unpark> Borrow<'a, U> { +impl Borrow<'_, U> { fn enter(&mut self, f: F) -> R where F: FnOnce() -> R, @@ -750,7 +750,7 @@ impl<'a, U: Unpark> Borrow<'a, U> { } } -impl<'a, U: Unpark> SpawnLocal for Borrow<'a, U> { +impl SpawnLocal for Borrow<'_, U> { fn spawn_local(&mut self, future: Pin>>, already_counted: bool) { if !already_counted { // NOTE: we have a borrow of the Runtime, so we know that it isn't shut down. @@ -770,7 +770,7 @@ impl CurrentRunner { { struct Reset<'a>(&'a CurrentRunner); - impl<'a> Drop for Reset<'a> { + impl Drop for Reset<'_> { fn drop(&mut self) { self.0.spawn.set(None); self.0.id.set(None); diff --git a/tokio-current-thread/src/scheduler.rs b/tokio-current-thread/src/scheduler.rs index 29dc42e41a5..06ad2aa62b8 100644 --- a/tokio-current-thread/src/scheduler.rs +++ b/tokio-current-thread/src/scheduler.rs @@ -253,7 +253,7 @@ where node: Option>>, } - impl<'a, U: Unpark> Drop for Bomb<'a, U> { + impl Drop for Bomb<'_, U> { fn drop(&mut self) { if let Some(node) = self.node.take() { self.borrow.enter(|| release_node(node)) @@ -329,7 +329,7 @@ where } } -impl<'a, U: Unpark> Scheduled<'a, U> { +impl Scheduled<'_, U> { /// Polls the task, returns `true` if the task has completed. pub fn tick(&mut self) -> bool { let waker = unsafe { diff --git a/tokio-current-thread/tests/current_thread.rs b/tokio-current-thread/tests/current_thread.rs index a2ec5ce6d7a..48fe7bdd954 100644 --- a/tokio-current-thread/tests/current_thread.rs +++ b/tokio-current-thread/tests/current_thread.rs @@ -380,7 +380,6 @@ mod and_turn { }, ); } - } mod in_drop { @@ -441,7 +440,6 @@ mod in_drop { }, ); } - } /* diff --git a/tokio-executor/src/global.rs b/tokio-executor/src/global.rs index f95a148632b..bf4d9be388a 100644 --- a/tokio-executor/src/global.rs +++ b/tokio-executor/src/global.rs @@ -153,7 +153,7 @@ where // when leaving the scope. This handles cases that involve panicking. struct Reset<'a>(&'a Cell, State); - impl<'a> Drop for Reset<'a> { + impl Drop for Reset<'_> { fn drop(&mut self) { self.0.set(self.1); } diff --git a/tokio-io/src/async_buf_read.rs b/tokio-io/src/async_buf_read.rs index d0c4952d8e2..dfac44f3e11 100644 --- a/tokio-io/src/async_buf_read.rs +++ b/tokio-io/src/async_buf_read.rs @@ -31,10 +31,7 @@ pub trait AsyncBufRead: AsyncRead { /// /// [`poll_read`]: AsyncRead::poll_read /// [`consume`]: AsyncBufRead::consume - fn poll_fill_buf<'a>( - self: Pin<&'a mut Self>, - cx: &mut Context<'_>, - ) -> Poll>; + fn poll_fill_buf(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll>; /// Tells this buffer that `amt` bytes have been consumed from the buffer, /// so they should no longer be returned in calls to [`poll_read`]. @@ -56,8 +53,8 @@ pub trait AsyncBufRead: AsyncRead { macro_rules! deref_async_buf_read { () => { - fn poll_fill_buf<'a>(self: Pin<&'a mut Self>, cx: &mut Context<'_>) - -> Poll> + fn poll_fill_buf(self: Pin<&mut Self>, cx: &mut Context<'_>) + -> Poll> { Pin::new(&mut **self.get_mut()).poll_fill_buf(cx) } @@ -81,10 +78,7 @@ where P: DerefMut + Unpin, P::Target: AsyncBufRead, { - fn poll_fill_buf<'a>( - self: Pin<&'a mut Self>, - cx: &mut Context<'_>, - ) -> Poll> { + fn poll_fill_buf(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { self.get_mut().as_mut().poll_fill_buf(cx) } @@ -94,10 +88,7 @@ where } impl AsyncBufRead for &[u8] { - fn poll_fill_buf<'a>( - self: Pin<&'a mut Self>, - _cx: &mut Context<'_>, - ) -> Poll> { + fn poll_fill_buf(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll> { Poll::Ready(Ok(*self)) } @@ -107,10 +98,7 @@ impl AsyncBufRead for &[u8] { } impl + Unpin> AsyncBufRead for io::Cursor { - fn poll_fill_buf<'a>( - self: Pin<&'a mut Self>, - _cx: &mut Context<'_>, - ) -> Poll> { + fn poll_fill_buf(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll> { Poll::Ready(io::BufRead::fill_buf(self.get_mut())) } diff --git a/tokio-io/src/io/copy.rs b/tokio-io/src/io/copy.rs index f363e308de0..688eb5029b3 100644 --- a/tokio-io/src/io/copy.rs +++ b/tokio-io/src/io/copy.rs @@ -33,7 +33,7 @@ where } } -impl<'a, R, W> Future for Copy<'a, R, W> +impl Future for Copy<'_, R, W> where R: AsyncRead + Unpin + ?Sized, W: AsyncWrite + Unpin + ?Sized, diff --git a/tokio-io/src/io/flush.rs b/tokio-io/src/io/flush.rs index 6fef526b921..6be90fcc267 100644 --- a/tokio-io/src/io/flush.rs +++ b/tokio-io/src/io/flush.rs @@ -22,7 +22,7 @@ where Flush { a } } -impl<'a, A> Unpin for Flush<'a, A> where A: Unpin + ?Sized {} +impl Unpin for Flush<'_, A> where A: Unpin + ?Sized {} impl Future for Flush<'_, A> where diff --git a/tokio-io/src/io/read.rs b/tokio-io/src/io/read.rs index 449dac777b9..62f2fea0832 100644 --- a/tokio-io/src/io/read.rs +++ b/tokio-io/src/io/read.rs @@ -29,7 +29,7 @@ pub struct Read<'a, R: ?Sized> { } // forward Unpin -impl<'a, R: Unpin + ?Sized> Unpin for Read<'_, R> {} +impl Unpin for Read<'_, R> {} impl Future for Read<'_, R> where diff --git a/tokio-io/src/io/read_exact.rs b/tokio-io/src/io/read_exact.rs index 63006ab27db..6a616b97a24 100644 --- a/tokio-io/src/io/read_exact.rs +++ b/tokio-io/src/io/read_exact.rs @@ -40,7 +40,7 @@ fn eof() -> io::Error { } // forward Unpin -impl<'a, A: Unpin + ?Sized> Unpin for ReadExact<'_, A> {} +impl Unpin for ReadExact<'_, A> {} impl Future for ReadExact<'_, A> where diff --git a/tokio-io/src/io/shutdown.rs b/tokio-io/src/io/shutdown.rs index 4d01c46a62c..f22c6e55157 100644 --- a/tokio-io/src/io/shutdown.rs +++ b/tokio-io/src/io/shutdown.rs @@ -22,7 +22,7 @@ where Shutdown { a } } -impl<'a, A> Unpin for Shutdown<'a, A> where A: Unpin + ?Sized {} +impl Unpin for Shutdown<'_, A> where A: Unpin + ?Sized {} impl Future for Shutdown<'_, A> where diff --git a/tokio-io/src/io/write.rs b/tokio-io/src/io/write.rs index 89ee86a395a..1f27f605670 100644 --- a/tokio-io/src/io/write.rs +++ b/tokio-io/src/io/write.rs @@ -22,7 +22,7 @@ where } // forward Unpin -impl<'a, W: Unpin + ?Sized> Unpin for Write<'a, W> {} +impl Unpin for Write<'_, W> {} impl Future for Write<'_, W> where diff --git a/tokio-process/src/kill.rs b/tokio-process/src/kill.rs index 25d7d9a5dce..0f7bdcbb8bf 100644 --- a/tokio-process/src/kill.rs +++ b/tokio-process/src/kill.rs @@ -6,7 +6,7 @@ pub(crate) trait Kill { fn kill(&mut self) -> io::Result<()>; } -impl<'a, T: 'a + Kill> Kill for &'a mut T { +impl Kill for &mut T { fn kill(&mut self) -> io::Result<()> { (**self).kill() } diff --git a/tokio-process/src/unix/orphan.rs b/tokio-process/src/unix/orphan.rs index 011cdfc7e81..b7064735bb3 100644 --- a/tokio-process/src/unix/orphan.rs +++ b/tokio-process/src/unix/orphan.rs @@ -10,7 +10,7 @@ pub(crate) trait Wait { fn try_wait(&mut self) -> io::Result>; } -impl<'a, T: 'a + Wait> Wait for &'a mut T { +impl Wait for &mut T { fn id(&self) -> u32 { (**self).id() } @@ -29,7 +29,7 @@ pub(crate) trait OrphanQueue { fn reap_orphans(&self); } -impl<'a, T, O: 'a + OrphanQueue> OrphanQueue for &'a O { +impl> OrphanQueue for &O { fn push_orphan(&self, orphan: T) { (**self).push_orphan(orphan); } diff --git a/tokio-signal/examples/multiple.rs b/tokio-signal/examples/multiple.rs index c1ba96c26ca..5157fb1bb24 100644 --- a/tokio-signal/examples/multiple.rs +++ b/tokio-signal/examples/multiple.rs @@ -35,7 +35,6 @@ mod platform { println!("received SIGTERM"); } } - } #[cfg(not(unix))] diff --git a/tokio-sync/src/task/atomic_waker.rs b/tokio-sync/src/task/atomic_waker.rs index 6f741d3865c..4085bc0bd31 100644 --- a/tokio-sync/src/task/atomic_waker.rs +++ b/tokio-sync/src/task/atomic_waker.rs @@ -306,7 +306,7 @@ impl WakerRef for Waker { } } -impl<'a> WakerRef for &'a Waker { +impl WakerRef for &Waker { fn wake(self) { self.wake_by_ref() } diff --git a/tokio-sync/src/watch.rs b/tokio-sync/src/watch.rs index 4312c153bf9..a140cd29d77 100644 --- a/tokio-sync/src/watch.rs +++ b/tokio-sync/src/watch.rs @@ -249,7 +249,7 @@ impl Receiver { /// /// Only the **most recent** value is returned. If the receiver is falling /// behind the sender, intermediate values are dropped. - pub async fn recv_ref<'a>(&'a mut self) -> Option> { + pub async fn recv_ref(&mut self) -> Option> { let shared = &self.shared; let inner = &self.inner; let version = self.ver; @@ -445,7 +445,7 @@ impl Drop for Sender { // ===== impl Ref ===== -impl<'a, T: 'a> ops::Deref for Ref<'a, T> { +impl ops::Deref for Ref<'_, T> { type Target = T; fn deref(&self) -> &T { diff --git a/tokio-sync/tests/fuzz_oneshot.rs b/tokio-sync/tests/fuzz_oneshot.rs index ae990a0c96d..d1bcb40ea0b 100644 --- a/tokio-sync/tests/fuzz_oneshot.rs +++ b/tokio-sync/tests/fuzz_oneshot.rs @@ -78,7 +78,7 @@ impl<'a> OnClose<'a> { } } -impl<'a> Future for OnClose<'a> { +impl Future for OnClose<'_> { type Output = bool; fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { diff --git a/tokio-threadpool/src/sender.rs b/tokio-threadpool/src/sender.rs index 74da374de4e..30e10b048e9 100644 --- a/tokio-threadpool/src/sender.rs +++ b/tokio-threadpool/src/sender.rs @@ -136,7 +136,7 @@ impl tokio_executor::Executor for Sender { } } -impl<'a> tokio_executor::Executor for &'a Sender { +impl tokio_executor::Executor for &Sender { fn status(&self) -> Result<(), tokio_executor::SpawnError> { let state: pool::State = self.pool.state.load(Acquire).into(); diff --git a/tokio-threadpool/src/task/mod.rs b/tokio-threadpool/src/task/mod.rs index 81bb7c2d595..2a225a1459c 100644 --- a/tokio-threadpool/src/task/mod.rs +++ b/tokio-threadpool/src/task/mod.rs @@ -124,7 +124,7 @@ impl Task { let res = panic::catch_unwind(panic::AssertUnwindSafe(|| { struct Guard<'a>(&'a mut Option, bool); - impl<'a> Drop for Guard<'a> { + impl Drop for Guard<'_> { fn drop(&mut self) { // This drops the future if self.1 { diff --git a/tokio-threadpool/src/worker/mod.rs b/tokio-threadpool/src/worker/mod.rs index 34ce41b96f8..3bd006bb62d 100644 --- a/tokio-threadpool/src/worker/mod.rs +++ b/tokio-threadpool/src/worker/mod.rs @@ -530,7 +530,7 @@ impl Worker { worker: &'a Worker, } - impl<'a> Drop for Guard<'a> { + impl Drop for Guard<'_> { fn drop(&mut self) { // A task is allocated at run when it was explicitly notified // that the task has capacity to block. When this happens, that diff --git a/tokio-threadpool/tests/threadpool.rs b/tokio-threadpool/tests/threadpool.rs index 5636a3b80d6..cf3af15c568 100644 --- a/tokio-threadpool/tests/threadpool.rs +++ b/tokio-threadpool/tests/threadpool.rs @@ -350,7 +350,7 @@ fn busy_threadpool_is_not_idle() { struct IdleFut<'a>(&'a mut Shutdown); - impl<'a> Future for IdleFut<'a> { + impl Future for IdleFut<'_> { type Output = (); fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()> { diff --git a/tokio-timer/src/clock/mod.rs b/tokio-timer/src/clock/mod.rs index bcae9ddaad0..cb15c37983a 100644 --- a/tokio-timer/src/clock/mod.rs +++ b/tokio-timer/src/clock/mod.rs @@ -142,7 +142,7 @@ where // when leaving the scope. This handles cases that involve panicking. struct Reset<'a>(&'a Cell>); - impl<'a> Drop for Reset<'a> { + impl Drop for Reset<'_> { fn drop(&mut self) { self.0.set(None); } diff --git a/tokio-tls/src/lib.rs b/tokio-tls/src/lib.rs index afc30fb18e2..3d8900ce71c 100644 --- a/tokio-tls/src/lib.rs +++ b/tokio-tls/src/lib.rs @@ -72,7 +72,7 @@ struct Guard<'a, S>(&'a mut TlsStream) where AllowStd: Read + Write; -impl<'a, S> Drop for Guard<'a, S> +impl Drop for Guard<'_, S> where AllowStd: Read + Write, { diff --git a/tokio-udp/src/split.rs b/tokio-udp/src/split.rs index c45bf567eee..d3b2bbdd6e1 100644 --- a/tokio-udp/src/split.rs +++ b/tokio-udp/src/split.rs @@ -101,7 +101,7 @@ impl UdpSocketRecvHalf { /// will fail if the socket is not connected. /// /// [`connect`]: super::UdpSocket::connect - pub async fn recv<'a, 'b>(&'a mut self, buf: &'b mut [u8]) -> io::Result { + pub async fn recv(&mut self, buf: &mut [u8]) -> io::Result { poll_fn(|cx| self.0.poll_recv_priv(cx, buf)).await } } diff --git a/tokio-uds/src/listener.rs b/tokio-uds/src/listener.rs index 917c157588f..5634d42581e 100644 --- a/tokio-uds/src/listener.rs +++ b/tokio-uds/src/listener.rs @@ -52,7 +52,7 @@ impl UnixListener { } /// Accepts a new incoming connection to this listener. - // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 + // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 pub async fn accept(&mut self) -> io::Result<(UnixStream, SocketAddr)> { poll_fn(|cx| self.poll_accept(cx)).await } diff --git a/tokio/examples/tinyhttp.rs b/tokio/examples/tinyhttp.rs index cd92d1af0a7..ea0b6719a36 100644 --- a/tokio/examples/tinyhttp.rs +++ b/tokio/examples/tinyhttp.rs @@ -133,7 +133,7 @@ impl Encoder for Http { // doesn't go through io::Error. struct BytesWrite<'a>(&'a mut BytesMut); - impl<'a> fmt::Write for BytesWrite<'a> { + impl fmt::Write for BytesWrite<'_> { fn write_str(&mut self, s: &str) -> fmt::Result { self.0.extend_from_slice(s.as_bytes()); Ok(()) @@ -289,7 +289,7 @@ mod date { struct LocalBuffer<'a>(&'a mut LastRenderedNow); - impl<'a> fmt::Write for LocalBuffer<'a> { + impl fmt::Write for LocalBuffer<'_> { fn write_str(&mut self, s: &str) -> fmt::Result { let start = self.0.amt; let end = start + s.len(); From d0a565706e833e087e0f460f50a858e7b4e41ddb Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Sat, 3 Aug 2019 14:53:38 +0900 Subject: [PATCH 5/6] ci: removed needless toolchain install --- ci/azure-install-rust.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/ci/azure-install-rust.yml b/ci/azure-install-rust.yml index 2892ab8975e..02176592a6f 100644 --- a/ci/azure-install-rust.yml +++ b/ci/azure-install-rust.yml @@ -27,8 +27,6 @@ steps: # All platforms. - script: | - rustup toolchain install nightly - rustup update rustup toolchain list rustc -Vv cargo -V From f73fa3dc903be86d32c46c8b6dc141bac7bd27f6 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Sat, 10 Aug 2019 15:41:19 +0900 Subject: [PATCH 6/6] fix --- tokio-sync/src/watch.rs | 2 +- tokio-uds/src/listener.rs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/tokio-sync/src/watch.rs b/tokio-sync/src/watch.rs index a140cd29d77..8067ed3b2a5 100644 --- a/tokio-sync/src/watch.rs +++ b/tokio-sync/src/watch.rs @@ -295,7 +295,7 @@ impl Receiver { /// /// This is equivalent to calling `clone()` on the value returned by /// `recv()`. - #[allow(clippy::needless_lifetimes, clippy::map_clone)] // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 + #[allow(clippy::map_clone)] // false positive: https://github.com/rust-lang/rust-clippy/issues/3274 pub async fn recv(&mut self) -> Option { self.recv_ref().await.map(|v_ref| v_ref.clone()) } diff --git a/tokio-uds/src/listener.rs b/tokio-uds/src/listener.rs index 5634d42581e..7cbfdb54342 100644 --- a/tokio-uds/src/listener.rs +++ b/tokio-uds/src/listener.rs @@ -52,7 +52,6 @@ impl UnixListener { } /// Accepts a new incoming connection to this listener. - // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 pub async fn accept(&mut self) -> io::Result<(UnixStream, SocketAddr)> { poll_fn(|cx| self.poll_accept(cx)).await }