* [PATCH] rust: allow `clippy::needless_lifetimes`
@ 2024-11-16 18:15 ` Miguel Ojeda
2024-11-18 9:51 ` Alice Ryhl
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Miguel Ojeda @ 2024-11-16 18:15 UTC (permalink / raw)
To: Miguel Ojeda, Alex Gaynor
Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, Trevor Gross, rust-for-linux,
linux-kernel, patches
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@kernel.org>
---
Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/Makefile b/Makefile
index a9e723cb0596..00a444603fb1 100644
--- a/Makefile
+++ b/Makefile
@@ -456,6 +456,7 @@ export rust_common_flags := --edition=2021 \
-Wclippy::mut_mut \
-Wclippy::needless_bitwise_bool \
-Wclippy::needless_continue \
+ -Aclippy::needless_lifetimes \
-Wclippy::no_mangle_with_rust_abi \
-Wclippy::undocumented_unsafe_blocks \
-Wclippy::unnecessary_safety_comment \
base-commit: b2603f8ac8217bc59f5c7f248ac248423b9b99cb
--
2.47.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] rust: allow `clippy::needless_lifetimes`
2024-11-16 18:15 ` [PATCH] rust: allow `clippy::needless_lifetimes` Miguel Ojeda
@ 2024-11-18 9:51 ` Alice Ryhl
2024-11-24 23:55 ` Miguel Ojeda
2024-11-18 10:26 ` Andreas Hindborg
2024-11-24 23:55 ` Miguel Ojeda
2 siblings, 1 reply; 5+ messages in thread
From: Alice Ryhl @ 2024-11-18 9:51 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Trevor Gross, rust-for-linux,
linux-kernel, patches
On Sat, Nov 16, 2024 at 7:16 PM Miguel Ojeda <ojeda@kernel.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@kernel.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Does this need any backports to keep old kernels warning-free on new compilers?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rust: allow `clippy::needless_lifetimes`
2024-11-16 18:15 ` [PATCH] rust: allow `clippy::needless_lifetimes` Miguel Ojeda
2024-11-18 9:51 ` Alice Ryhl
@ 2024-11-18 10:26 ` Andreas Hindborg
2024-11-24 23:55 ` Miguel Ojeda
2 siblings, 0 replies; 5+ messages in thread
From: Andreas Hindborg @ 2024-11-18 10:26 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Alice Ryhl, Trevor Gross, rust-for-linux,
linux-kernel, patches
"Miguel Ojeda" <ojeda@kernel.org> writes:
> 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@kernel.org>
> ---
Reviewed-by: Andreas Hindborg <a.hindborg@kernel.org>
Best regards,
Andreas Hindborg
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rust: allow `clippy::needless_lifetimes`
2024-11-18 9:51 ` Alice Ryhl
@ 2024-11-24 23:55 ` Miguel Ojeda
0 siblings, 0 replies; 5+ messages in thread
From: Miguel Ojeda @ 2024-11-24 23:55 UTC (permalink / raw)
To: Alice Ryhl
Cc: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg,
Trevor Gross, rust-for-linux, linux-kernel, patches
On Mon, Nov 18, 2024 at 10:51 AM Alice Ryhl <aliceryhl@google.com> wrote:
>
> Does this need any backports to keep old kernels warning-free on new compilers?
+1, for stable, yeah, if we want to keep it Clippy-clean (which I
think we should, especially given it is straightforward). I will send
it.
For the LTSs, which only support a single compiler, there is no need.
Cheers,
Miguel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rust: allow `clippy::needless_lifetimes`
2024-11-16 18:15 ` [PATCH] rust: allow `clippy::needless_lifetimes` Miguel Ojeda
2024-11-18 9:51 ` Alice Ryhl
2024-11-18 10:26 ` Andreas Hindborg
@ 2024-11-24 23:55 ` Miguel Ojeda
2 siblings, 0 replies; 5+ messages in thread
From: Miguel Ojeda @ 2024-11-24 23:55 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
rust-for-linux, linux-kernel, patches
On Sat, Nov 16, 2024 at 7:16 PM Miguel Ojeda <ojeda@kernel.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@kernel.org>
Applied to `rust-next` so that no one gets warnings on Thursday under
`CLIPPY=1` -- thanks everyone!
Cheers,
Miguel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-11-24 23:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <EFX-31VoeCMlETFeBCV5AsLQH8mV4szc26gB1uEEnYvF2z6YRevjYkQV7KZpoyoVFkoukFyYBc35hVpVzivEvg==@protonmail.internalid>
2024-11-16 18:15 ` [PATCH] rust: allow `clippy::needless_lifetimes` Miguel Ojeda
2024-11-18 9:51 ` Alice Ryhl
2024-11-24 23:55 ` Miguel Ojeda
2024-11-18 10:26 ` Andreas Hindborg
2024-11-24 23:55 ` Miguel Ojeda
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).