[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANiq72m46L5sqU_fUapFMNF6m4mA9XHRaT-bRsPA7kffBmwnSg@mail.gmail.com>
Date: Mon, 25 Nov 2024 00:55:47 +0100
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Miguel Ojeda <ojeda@...nel.org>
Cc: Alex Gaynor <alex.gaynor@...il.com>, Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>, Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>, Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>, rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org, patches@...ts.linux.dev
Subject: Re: [PATCH] rust: allow `clippy::needless_lifetimes`
On Sat, Nov 16, 2024 at 7:16 PM Miguel Ojeda <ojeda@...nel.org> wrote:
>
> In beta Clippy (i.e. Rust 1.83.0), the `needless_lifetimes` lint has
> been extended [1] to suggest eliding `impl` lifetimes, e.g.
>
> error: the following explicit lifetimes could be elided: 'a
> --> rust/kernel/list.rs:647:6
> |
> 647 | impl<'a, T: ?Sized + ListItem<ID>, const ID: u64> FusedIterator for Iter<'a, T, ID> {}
> | ^^ ^^
> |
> = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
> = note: `-D clippy::needless-lifetimes` implied by `-D warnings`
> = help: to override `-D warnings` add `#[allow(clippy::needless_lifetimes)]`
> help: elide the lifetimes
> |
> 647 - impl<'a, T: ?Sized + ListItem<ID>, const ID: u64> FusedIterator for Iter<'a, T, ID> {}
> 647 + impl<T: ?Sized + ListItem<ID>, const ID: u64> FusedIterator for Iter<'_, T, ID> {}
>
> A possibility would have been to clean them -- the RFC patch [2] did
> this, while asking if we wanted these cleanups. There is an open issue
> [3] in Clippy about being able to differentiate some of the new cases,
> e.g. those that do not involve introducing `'_`. Thus it seems others
> feel similarly.
>
> Thus, for the time being, we decided to `allow` the lint.
>
> Link: https://github.com/rust-lang/rust-clippy/pull/13286 [1]
> Link: https://lore.kernel.org/rust-for-linux/20241012231300.397010-1-ojeda@kernel.org/ [2]
> Link: https://github.com/rust-lang/rust-clippy/issues/13514 [3]
> Signed-off-by: Miguel Ojeda <ojeda@...nel.org>
Applied to `rust-next` so that no one gets warnings on Thursday under
`CLIPPY=1` -- thanks everyone!
Cheers,
Miguel
Powered by blists - more mailing lists