diff --git a/.cirrus.yml b/.cirrus.yml index 43b0b51fd03..e3fecc1db21 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-01 - . $HOME/.cargo/env - rustup target add i686-unknown-freebsd - | diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d6777c177ea..ced35a3f588 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -2,13 +2,13 @@ trigger: ["master", "std-future"] pr: ["master", "std-future"] variables: - nightly: nightly-2019-07-17 + nightly: nightly-2019-08-01 jobs: # Check formatting - template: ci/azure-rustfmt.yml parameters: - rust: $(nightly) + rust: nightly-2019-07-17 # workaround for https://github.com/rust-lang/rustfmt/issues/3725 name: rustfmt # Apply clippy lints to all crates 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 diff --git a/ci/azure-rustfmt.yml b/ci/azure-rustfmt.yml index 7e01bfbbd58..0cf67fdf105 100644 --- a/ci/azure-rustfmt.yml +++ b/ci/azure-rustfmt.yml @@ -9,9 +9,9 @@ jobs: parameters: rust_version: ${{ parameters.rust }} - script: | - rustup component add rustfmt - cargo fmt --version + rustup component add rustfmt --toolchain ${{ parameters.rust }} + cargo +${{ parameters.rust }} fmt --version displayName: Install rustfmt - script: | - cargo fmt --all -- --check + cargo +${{ parameters.rust }} fmt --all -- --check displayName: Check formatting diff --git a/rust-toolchain b/rust-toolchain index fead76e739c..4390c8a2843 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2019-07-17 \ No newline at end of file +nightly-2019-08-01 diff --git a/tokio-codec/tests/framed_read.rs b/tokio-codec/tests/framed_read.rs index 64d574c08b0..3c7dd1558d8 100644 --- a/tokio-codec/tests/framed_read.rs +++ b/tokio-codec/tests/framed_read.rs @@ -291,7 +291,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( self: Pin<&mut Self>, _cx: &mut Context<'_>, diff --git a/tokio-current-thread/src/lib.rs b/tokio-current-thread/src/lib.rs index 7d32b87c6f2..267f77ea507 100644 --- a/tokio-current-thread/src/lib.rs +++ b/tokio-current-thread/src/lib.rs @@ -430,7 +430,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. @@ -594,7 +594,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) @@ -739,7 +739,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, @@ -751,7 +751,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. @@ -771,7 +771,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 49a40706805..13c899f70b1 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-executor/tests/enter.rs b/tokio-executor/tests/enter.rs index c0586d6664d..36b4636ef1f 100644 --- a/tokio-executor/tests/enter.rs +++ b/tokio-executor/tests/enter.rs @@ -1,5 +1,5 @@ #![deny(warnings, 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 930f91162eb..7f2adb24aba 100644 --- a/tokio-executor/tests/executor.rs +++ b/tokio-executor/tests/executor.rs @@ -1,5 +1,5 @@ #![deny(warnings, rust_2018_idioms)] -#![feature(await_macro, async_await)] +#![feature(async_await)] use tokio_executor::{self, DefaultExecutor}; diff --git a/tokio-io/src/async_buf_read.rs b/tokio-io/src/async_buf_read.rs index 9c2c55db84f..aa087fed006 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) } 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-io/tests/lines.rs b/tokio-io/tests/lines.rs index 63600db2e5a..3181e9d6a84 100644 --- a/tokio-io/tests/lines.rs +++ b/tokio-io/tests/lines.rs @@ -26,10 +26,7 @@ async fn lines() { } impl AsyncBufRead for Rd { - fn poll_fill_buf<'a>( - self: Pin<&'a mut Self>, - _: &mut Context<'_>, - ) -> Poll> { + fn poll_fill_buf(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll> { Poll::Ready(Ok(self.val)) } diff --git a/tokio-io/tests/read_line.rs b/tokio-io/tests/read_line.rs index e8312c06564..e747b8288ec 100644 --- a/tokio-io/tests/read_line.rs +++ b/tokio-io/tests/read_line.rs @@ -25,10 +25,7 @@ async fn read_line() { } impl AsyncBufRead for Rd { - fn poll_fill_buf<'a>( - self: Pin<&'a mut Self>, - _: &mut Context<'_>, - ) -> Poll> { + fn poll_fill_buf(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll> { Poll::Ready(Ok(self.val)) } diff --git a/tokio-io/tests/read_until.rs b/tokio-io/tests/read_until.rs index 087e5e250a9..c219f9ab191 100644 --- a/tokio-io/tests/read_until.rs +++ b/tokio-io/tests/read_until.rs @@ -25,10 +25,7 @@ async fn read_until() { } impl AsyncBufRead for Rd { - fn poll_fill_buf<'a>( - self: Pin<&'a mut Self>, - _: &mut Context<'_>, - ) -> Poll> { + fn poll_fill_buf(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll> { Poll::Ready(Ok(self.val)) } 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 6f456ce0e86..181d468a307 100644 --- a/tokio-process/src/unix/orphan.rs +++ b/tokio-process/src/unix/orphan.rs @@ -12,7 +12,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() } @@ -31,7 +31,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 996af50d6c7..033c8ed0a51 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/mpsc/bounded.rs b/tokio-sync/src/mpsc/bounded.rs index 4e32a1ce4a0..c549f5498f7 100644 --- a/tokio-sync/src/mpsc/bounded.rs +++ b/tokio-sync/src/mpsc/bounded.rs @@ -132,7 +132,6 @@ impl Receiver { } /// TODO: Dox - #[allow(clippy::needless_lifetimes)] // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 pub async fn recv(&mut self) -> Option { use async_util::future::poll_fn; @@ -205,7 +204,6 @@ impl Sender { /// ``` /// unimplemented!(); /// ``` - #[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 async_util::future::poll_fn; diff --git a/tokio-sync/src/mpsc/unbounded.rs b/tokio-sync/src/mpsc/unbounded.rs index 9de0ae12fa0..dd1664a467c 100644 --- a/tokio-sync/src/mpsc/unbounded.rs +++ b/tokio-sync/src/mpsc/unbounded.rs @@ -93,7 +93,6 @@ impl UnboundedReceiver { } /// TODO: Dox - #[allow(clippy::needless_lifetimes)] // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 pub async fn recv(&mut self) -> Option { use async_util::future::poll_fn; diff --git a/tokio-sync/src/oneshot.rs b/tokio-sync/src/oneshot.rs index a51f8028948..a5d8fdc49b4 100644 --- a/tokio-sync/src/oneshot.rs +++ b/tokio-sync/src/oneshot.rs @@ -220,7 +220,6 @@ impl Sender { /// ``` /// unimplemented!(); /// ``` - #[allow(clippy::needless_lifetimes)] // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 pub async fn closed(&mut self) { use async_util::future::poll_fn; 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 6efe437db3b..0cc0164d211 100644 --- a/tokio-sync/src/watch.rs +++ b/tokio-sync/src/watch.rs @@ -412,7 +412,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 b0191f209d8..c3b632dd207 100644 --- a/tokio-sync/tests/fuzz_oneshot.rs +++ b/tokio-sync/tests/fuzz_oneshot.rs @@ -73,7 +73,7 @@ impl<'a> OnClose<'a> { } } -impl<'a> Future for OnClose<'a> { +impl Future for OnClose<'_> { type Output = (); fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()> { diff --git a/tokio-tcp/src/listener.rs b/tokio-tcp/src/listener.rs index 66392a699a7..4eb39a65461 100644 --- a/tokio-tcp/src/listener.rs +++ b/tokio-tcp/src/listener.rs @@ -124,7 +124,6 @@ impl TcpListener { /// ``` /// unimplemented!(); /// ``` - #[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)> { use async_util::future::poll_fn; poll_fn(|cx| self.poll_accept(cx)).await diff --git a/tokio-threadpool/src/sender.rs b/tokio-threadpool/src/sender.rs index b2803806db1..20c1bdd4792 100644 --- a/tokio-threadpool/src/sender.rs +++ b/tokio-threadpool/src/sender.rs @@ -138,7 +138,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 0477dd517d2..f10e5e655fd 100644 --- a/tokio-threadpool/src/task/mod.rs +++ b/tokio-threadpool/src/task/mod.rs @@ -123,7 +123,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 3214acd838a..6cbd57b36cb 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-timer/src/delay_queue.rs b/tokio-timer/src/delay_queue.rs index 32ae1c26ece..0c1f4afa9a7 100644 --- a/tokio-timer/src/delay_queue.rs +++ b/tokio-timer/src/delay_queue.rs @@ -370,7 +370,6 @@ impl DelayQueue { } /// TODO: Dox... also is the fn signature correct? - #[allow(clippy::needless_lifetimes)] // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 #[allow(clippy::should_implement_trait)] // false positive : https://github.com/rust-lang/rust-clippy/issues/4290 pub async fn next(&mut self) -> Option, Error>> { use async_util::future::poll_fn; diff --git a/tokio-timer/src/interval.rs b/tokio-timer/src/interval.rs index 2d37647c593..ab06d082b8a 100644 --- a/tokio-timer/src/interval.rs +++ b/tokio-timer/src/interval.rs @@ -72,7 +72,6 @@ impl Interval { } /// TODO: dox - #[allow(clippy::needless_lifetimes)] // false positive: https://github.com/rust-lang/rust-clippy/issues/3988 #[allow(clippy::should_implement_trait)] // false positive : https://github.com/rust-lang/rust-clippy/issues/4290 pub async fn next(&mut self) -> Option { use async_util::future::poll_fn; diff --git a/tokio-tls/src/lib.rs b/tokio-tls/src/lib.rs index b16f047363b..af30f0b80a4 100644 --- a/tokio-tls/src/lib.rs +++ b/tokio-tls/src/lib.rs @@ -73,7 +73,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, { @@ -288,7 +288,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-udp/src/recv.rs b/tokio-udp/src/recv.rs index 47331d3ab25..9e6d827343a 100644 --- a/tokio-udp/src/recv.rs +++ b/tokio-udp/src/recv.rs @@ -20,7 +20,7 @@ impl<'a, 'b> Recv<'a, 'b> { } } -impl<'a, 'b> Future for Recv<'a, 'b> { +impl Future for Recv<'_, '_> { type Output = io::Result; fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { diff --git a/tokio-udp/src/recv_from.rs b/tokio-udp/src/recv_from.rs index 04bef680a13..3efc557b24e 100644 --- a/tokio-udp/src/recv_from.rs +++ b/tokio-udp/src/recv_from.rs @@ -21,7 +21,7 @@ impl<'a, 'b> RecvFrom<'a, 'b> { } } -impl<'a, 'b> Future for RecvFrom<'a, 'b> { +impl Future for RecvFrom<'_, '_> { type Output = io::Result<(usize, SocketAddr)>; fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { diff --git a/tokio-udp/src/send.rs b/tokio-udp/src/send.rs index 8fd1007f427..c6e8665ab96 100644 --- a/tokio-udp/src/send.rs +++ b/tokio-udp/src/send.rs @@ -20,7 +20,7 @@ impl<'a, 'b> Send<'a, 'b> { } } -impl<'a, 'b> Future for Send<'a, 'b> { +impl Future for Send<'_, '_> { type Output = io::Result; fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { diff --git a/tokio-udp/src/send_to.rs b/tokio-udp/src/send_to.rs index b7f2412148d..f680ff5a0d1 100644 --- a/tokio-udp/src/send_to.rs +++ b/tokio-udp/src/send_to.rs @@ -26,7 +26,7 @@ impl<'a, 'b> SendTo<'a, 'b> { } } -impl<'a, 'b> Future for SendTo<'a, 'b> { +impl Future for SendTo<'_, '_> { type Output = io::Result; fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { diff --git a/tokio-uds/src/listener.rs b/tokio-uds/src/listener.rs index 22ce198d131..0418136be28 100644 --- a/tokio-uds/src/listener.rs +++ b/tokio-uds/src/listener.rs @@ -186,7 +186,7 @@ pub struct Accept<'a> { listener: &'a mut UnixListener, } -impl<'a> Future for Accept<'a> { +impl Future for Accept<'_> { type Output = io::Result<(UnixStream, SocketAddr)>; fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { diff --git a/tokio-uds/src/recv.rs b/tokio-uds/src/recv.rs index 04e6060fdba..72bce2905a0 100644 --- a/tokio-uds/src/recv.rs +++ b/tokio-uds/src/recv.rs @@ -20,7 +20,7 @@ impl<'a, 'b> Recv<'a, 'b> { } } -impl<'a, 'b> Future for Recv<'a, 'b> { +impl Future for Recv<'_, '_> { type Output = io::Result; fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { diff --git a/tokio-uds/src/recv_from.rs b/tokio-uds/src/recv_from.rs index c2cb34bfffb..2102dc63f0c 100644 --- a/tokio-uds/src/recv_from.rs +++ b/tokio-uds/src/recv_from.rs @@ -21,7 +21,7 @@ impl<'a, 'b> RecvFrom<'a, 'b> { } } -impl<'a, 'b> Future for RecvFrom<'a, 'b> { +impl Future for RecvFrom<'_, '_> { type Output = io::Result<(usize, SocketAddr)>; fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { diff --git a/tokio-uds/src/send.rs b/tokio-uds/src/send.rs index 2abc5adeb4b..e1ba1d54390 100644 --- a/tokio-uds/src/send.rs +++ b/tokio-uds/src/send.rs @@ -20,7 +20,7 @@ impl<'a, 'b> Send<'a, 'b> { } } -impl<'a, 'b> Future for Send<'a, 'b> { +impl Future for Send<'_, '_> { type Output = io::Result; fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { diff --git a/tokio-uds/src/send_to.rs b/tokio-uds/src/send_to.rs index 5aa83e3ec44..0e9ecec3851 100644 --- a/tokio-uds/src/send_to.rs +++ b/tokio-uds/src/send_to.rs @@ -26,7 +26,7 @@ impl<'a, 'b, P> SendTo<'a, 'b, P> { } } -impl<'a, 'b, P> Future for SendTo<'a, 'b, P> +impl

Future for SendTo<'_, '_, P> where P: AsRef + Unpin, { diff --git a/tokio/examples/tinyhttp.rs b/tokio/examples/tinyhttp.rs index fbf62304f1a..2900d3bc1bf 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(); diff --git a/tokio/tests/length_delimited.rs b/tokio/tests/length_delimited.rs index 2b2fe563ce2..5f7a19a3e93 100644 --- a/tokio/tests/length_delimited.rs +++ b/tokio/tests/length_delimited.rs @@ -611,8 +611,8 @@ impl AsyncWrite for Mock { } } -impl<'a> From<&'a [u8]> for Op { - fn from(src: &'a [u8]) -> Op { +impl From<&[u8]> for Op { + fn from(src: &[u8]) -> Op { Op::Data(src.into()) } }