* [PATCH] rust: remove ignores for `clippy::new_ret_no_self`
@ 2023-09-23 2:46 Gary Guo
2023-09-23 8:07 ` Benno Lossin
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: Gary Guo @ 2023-09-23 2:46 UTC (permalink / raw)
To: Miguel Ojeda, Alex Gaynor, Wedson Almeida Filho, Boqun Feng,
Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
Alice Ryhl, Martin Rodriguez Reboredo, Ben Gooding
Cc: rust-for-linux, linux-kernel
The clippy false positive triggering `new_ret_no_self` lint when using
`pin_init!` macro is fixed in 1.67, so remove all `#[allow]`s ignoring
the lint.
Signed-off-by: Gary Guo <gary@garyguo.net>
---
rust/kernel/init.rs | 20 ++++++++++----------
rust/kernel/sync/condvar.rs | 1 -
rust/kernel/sync/lock.rs | 1 -
3 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/rust/kernel/init.rs b/rust/kernel/init.rs
index 4ebb6f23fc2e..65be9ae57b80 100644
--- a/rust/kernel/init.rs
+++ b/rust/kernel/init.rs
@@ -35,7 +35,7 @@
//! that you need to write `<-` instead of `:` for fields that you want to initialize in-place.
//!
//! ```rust
-//! # #![allow(clippy::disallowed_names, clippy::new_ret_no_self)]
+//! # #![allow(clippy::disallowed_names)]
//! use kernel::{prelude::*, sync::Mutex, new_mutex};
//! # use core::pin::Pin;
//! #[pin_data]
@@ -55,7 +55,7 @@
//! (or just the stack) to actually initialize a `Foo`:
//!
//! ```rust
-//! # #![allow(clippy::disallowed_names, clippy::new_ret_no_self)]
+//! # #![allow(clippy::disallowed_names)]
//! # use kernel::{prelude::*, sync::Mutex, new_mutex};
//! # use core::pin::Pin;
//! # #[pin_data]
@@ -86,7 +86,7 @@
//! To declare an init macro/function you just return an [`impl PinInit<T, E>`]:
//!
//! ```rust
-//! # #![allow(clippy::disallowed_names, clippy::new_ret_no_self)]
+//! # #![allow(clippy::disallowed_names)]
//! # use kernel::{sync::Mutex, prelude::*, new_mutex, init::PinInit, try_pin_init};
//! #[pin_data]
//! struct DriverData {
@@ -236,7 +236,7 @@
/// # Examples
///
/// ```rust
-/// # #![allow(clippy::disallowed_names, clippy::new_ret_no_self)]
+/// # #![allow(clippy::disallowed_names)]
/// # use kernel::{init, macros::pin_data, pin_init, stack_pin_init, init::*, sync::Mutex, new_mutex};
/// # use core::pin::Pin;
/// #[pin_data]
@@ -288,7 +288,7 @@ macro_rules! stack_pin_init {
/// # Examples
///
/// ```rust,ignore
-/// # #![allow(clippy::disallowed_names, clippy::new_ret_no_self)]
+/// # #![allow(clippy::disallowed_names)]
/// # use kernel::{init, pin_init, stack_try_pin_init, init::*, sync::Mutex, new_mutex};
/// # use macros::pin_data;
/// # use core::{alloc::AllocError, pin::Pin};
@@ -314,7 +314,7 @@ macro_rules! stack_pin_init {
/// ```
///
/// ```rust,ignore
-/// # #![allow(clippy::disallowed_names, clippy::new_ret_no_self)]
+/// # #![allow(clippy::disallowed_names)]
/// # use kernel::{init, pin_init, stack_try_pin_init, init::*, sync::Mutex, new_mutex};
/// # use macros::pin_data;
/// # use core::{alloc::AllocError, pin::Pin};
@@ -366,7 +366,7 @@ macro_rules! stack_try_pin_init {
/// The syntax is almost identical to that of a normal `struct` initializer:
///
/// ```rust
-/// # #![allow(clippy::disallowed_names, clippy::new_ret_no_self)]
+/// # #![allow(clippy::disallowed_names)]
/// # use kernel::{init, pin_init, macros::pin_data, init::*};
/// # use core::pin::Pin;
/// #[pin_data]
@@ -411,7 +411,7 @@ macro_rules! stack_try_pin_init {
/// To create an initializer function, simply declare it like this:
///
/// ```rust
-/// # #![allow(clippy::disallowed_names, clippy::new_ret_no_self)]
+/// # #![allow(clippy::disallowed_names)]
/// # use kernel::{init, pin_init, prelude::*, init::*};
/// # use core::pin::Pin;
/// # #[pin_data]
@@ -438,7 +438,7 @@ macro_rules! stack_try_pin_init {
/// Users of `Foo` can now create it like this:
///
/// ```rust
-/// # #![allow(clippy::disallowed_names, clippy::new_ret_no_self)]
+/// # #![allow(clippy::disallowed_names)]
/// # use kernel::{init, pin_init, macros::pin_data, init::*};
/// # use core::pin::Pin;
/// # #[pin_data]
@@ -466,7 +466,7 @@ macro_rules! stack_try_pin_init {
/// They can also easily embed it into their own `struct`s:
///
/// ```rust
-/// # #![allow(clippy::disallowed_names, clippy::new_ret_no_self)]
+/// # #![allow(clippy::disallowed_names)]
/// # use kernel::{init, pin_init, macros::pin_data, init::*};
/// # use core::pin::Pin;
/// # #[pin_data]
diff --git a/rust/kernel/sync/condvar.rs b/rust/kernel/sync/condvar.rs
index ed353399c4e5..b679b6f6dbeb 100644
--- a/rust/kernel/sync/condvar.rs
+++ b/rust/kernel/sync/condvar.rs
@@ -91,7 +91,6 @@ unsafe impl Sync for CondVar {}
impl CondVar {
/// Constructs a new condvar initialiser.
- #[allow(clippy::new_ret_no_self)]
pub fn new(name: &'static CStr, key: &'static LockClassKey) -> impl PinInit<Self> {
pin_init!(Self {
_pin: PhantomPinned,
diff --git a/rust/kernel/sync/lock.rs b/rust/kernel/sync/lock.rs
index 70a785f04754..f12a684bc957 100644
--- a/rust/kernel/sync/lock.rs
+++ b/rust/kernel/sync/lock.rs
@@ -99,7 +99,6 @@ unsafe impl<T: ?Sized + Send, B: Backend> Sync for Lock<T, B> {}
impl<T, B: Backend> Lock<T, B> {
/// Constructs a new lock initialiser.
- #[allow(clippy::new_ret_no_self)]
pub fn new(t: T, name: &'static CStr, key: &'static LockClassKey) -> impl PinInit<Self> {
pin_init!(Self {
data: UnsafeCell::new(t),
--
2.40.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] rust: remove ignores for `clippy::new_ret_no_self`
2023-09-23 2:46 [PATCH] rust: remove ignores for `clippy::new_ret_no_self` Gary Guo
@ 2023-09-23 8:07 ` Benno Lossin
2023-09-23 10:22 ` Finn Behrens
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Benno Lossin @ 2023-09-23 8:07 UTC (permalink / raw)
To: Gary Guo, Miguel Ojeda, Alex Gaynor, Wedson Almeida Filho,
Boqun Feng, Björn Roy Baron, Andreas Hindborg, Alice Ryhl,
Martin Rodriguez Reboredo, Ben Gooding
Cc: rust-for-linux, linux-kernel
On 23.09.23 04:46, Gary Guo wrote:
> The clippy false positive triggering `new_ret_no_self` lint when using
> `pin_init!` macro is fixed in 1.67, so remove all `#[allow]`s ignoring
> the lint.
>
> Signed-off-by: Gary Guo <gary@garyguo.net>
> ---
Reviewed-by: Benno Lossin <benno.lossin@proton.me>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] rust: remove ignores for `clippy::new_ret_no_self`
2023-09-23 2:46 [PATCH] rust: remove ignores for `clippy::new_ret_no_self` Gary Guo
2023-09-23 8:07 ` Benno Lossin
@ 2023-09-23 10:22 ` Finn Behrens
2023-09-23 10:36 ` Miguel Ojeda
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Finn Behrens @ 2023-09-23 10:22 UTC (permalink / raw)
To: Gary Guo
Cc: Miguel Ojeda, Alex Gaynor, Wedson Almeida Filho, Boqun Feng,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Martin Rodriguez Reboredo, Ben Gooding, rust-for-linux,
linux-kernel
On 23 Sep 2023, at 4:46, Gary Guo wrote:
> The clippy false positive triggering `new_ret_no_self` lint when using
> `pin_init!` macro is fixed in 1.67, so remove all `#[allow]`s ignoring
> the lint.
>
> Signed-off-by: Gary Guo <gary@garyguo.net>
> ---
Reviewed-by: Finn Behrens <me@kloenk.dev>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] rust: remove ignores for `clippy::new_ret_no_self`
2023-09-23 2:46 [PATCH] rust: remove ignores for `clippy::new_ret_no_self` Gary Guo
2023-09-23 8:07 ` Benno Lossin
2023-09-23 10:22 ` Finn Behrens
@ 2023-09-23 10:36 ` Miguel Ojeda
2023-09-23 12:01 ` Martin Rodriguez Reboredo
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Miguel Ojeda @ 2023-09-23 10:36 UTC (permalink / raw)
To: Gary Guo
Cc: Miguel Ojeda, Alex Gaynor, Wedson Almeida Filho, Boqun Feng,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Martin Rodriguez Reboredo, Ben Gooding, rust-for-linux,
linux-kernel
On Sat, Sep 23, 2023 at 4:47 AM Gary Guo <gary@garyguo.net> wrote:
>
> The clippy false positive triggering `new_ret_no_self` lint when using
> `pin_init!` macro is fixed in 1.67, so remove all `#[allow]`s ignoring
> the lint.
+1, thanks Gary, this is one I found thanks to the `#[expect]` series
I have to send. There are a couple others that I clean up there
(`non_send_fields_in_send_ty`, `dbg_macro`). Since you sent this one,
I will take your patch :)
If you don't mind, I will reword it a bit to add the couple links I had:
rust: kernel: remove `#[allow(clippy::new_ret_no_self)]`
Since Rust 1.67.0, Clippy's `new_ret_no_self` lint learnt to not
warn about `-> impl Trait<Self>` [1][2].
The kernel is nowadays on Rust 1.71.1, thus remove the `allow`.
Link: https://github.com/rust-lang/rust-clippy/issues/7344 [1]
Link: https://github.com/rust-lang/rust-clippy/pull/9733 [2]
Cheers,
Miguel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] rust: remove ignores for `clippy::new_ret_no_self`
2023-09-23 2:46 [PATCH] rust: remove ignores for `clippy::new_ret_no_self` Gary Guo
` (2 preceding siblings ...)
2023-09-23 10:36 ` Miguel Ojeda
@ 2023-09-23 12:01 ` Martin Rodriguez Reboredo
2023-09-23 14:11 ` Alice Ryhl
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Martin Rodriguez Reboredo @ 2023-09-23 12:01 UTC (permalink / raw)
To: Gary Guo, Miguel Ojeda, Alex Gaynor, Wedson Almeida Filho,
Boqun Feng, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
Alice Ryhl, Ben Gooding
Cc: rust-for-linux, linux-kernel
On 9/22/23 23:46, Gary Guo wrote:
> The clippy false positive triggering `new_ret_no_self` lint when using
> `pin_init!` macro is fixed in 1.67, so remove all `#[allow]`s ignoring
> the lint.
>
> Signed-off-by: Gary Guo <gary@garyguo.net>
> ---
> [...]
Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] rust: remove ignores for `clippy::new_ret_no_self`
2023-09-23 2:46 [PATCH] rust: remove ignores for `clippy::new_ret_no_self` Gary Guo
` (3 preceding siblings ...)
2023-09-23 12:01 ` Martin Rodriguez Reboredo
@ 2023-09-23 14:11 ` Alice Ryhl
2023-09-23 15:03 ` Benno Lossin
2023-10-05 16:34 ` Miguel Ojeda
6 siblings, 0 replies; 8+ messages in thread
From: Alice Ryhl @ 2023-09-23 14:11 UTC (permalink / raw)
To: Gary Guo
Cc: Miguel Ojeda, Alex Gaynor, Wedson Almeida Filho, Boqun Feng,
Björn Roy Baron, Benno Lossin, Andreas Hindborg,
Martin Rodriguez Reboredo, Ben Gooding, rust-for-linux,
linux-kernel
On Sat, Sep 23, 2023 at 4:47 AM Gary Guo <gary@garyguo.net> wrote:
>
> The clippy false positive triggering `new_ret_no_self` lint when using
> `pin_init!` macro is fixed in 1.67, so remove all `#[allow]`s ignoring
> the lint.
>
> Signed-off-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] rust: remove ignores for `clippy::new_ret_no_self`
2023-09-23 2:46 [PATCH] rust: remove ignores for `clippy::new_ret_no_self` Gary Guo
` (4 preceding siblings ...)
2023-09-23 14:11 ` Alice Ryhl
@ 2023-09-23 15:03 ` Benno Lossin
2023-10-05 16:34 ` Miguel Ojeda
6 siblings, 0 replies; 8+ messages in thread
From: Benno Lossin @ 2023-09-23 15:03 UTC (permalink / raw)
To: Gary Guo, Miguel Ojeda, Alex Gaynor, Wedson Almeida Filho,
Boqun Feng, Björn Roy Baron, Andreas Hindborg, Alice Ryhl,
Martin Rodriguez Reboredo, Ben Gooding
Cc: rust-for-linux, linux-kernel
On 23.09.23 04:46, Gary Guo wrote:
> The clippy false positive triggering `new_ret_no_self` lint when using
> `pin_init!` macro is fixed in 1.67, so remove all `#[allow]`s ignoring
> the lint.
>
> Signed-off-by: Gary Guo <gary@garyguo.net>
> ---
> rust/kernel/init.rs | 20 ++++++++++----------
> rust/kernel/sync/condvar.rs | 1 -
> rust/kernel/sync/lock.rs | 1 -
> 3 files changed, 10 insertions(+), 12 deletions(-)
>
Reviewed-by: Benno Lossin <benno.lossin@proton.me>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] rust: remove ignores for `clippy::new_ret_no_self`
2023-09-23 2:46 [PATCH] rust: remove ignores for `clippy::new_ret_no_self` Gary Guo
` (5 preceding siblings ...)
2023-09-23 15:03 ` Benno Lossin
@ 2023-10-05 16:34 ` Miguel Ojeda
6 siblings, 0 replies; 8+ messages in thread
From: Miguel Ojeda @ 2023-10-05 16:34 UTC (permalink / raw)
To: Gary Guo
Cc: Miguel Ojeda, Alex Gaynor, Wedson Almeida Filho, Boqun Feng,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Martin Rodriguez Reboredo, Ben Gooding, rust-for-linux,
linux-kernel
On Sat, Sep 23, 2023 at 4:47 AM Gary Guo <gary@garyguo.net> wrote:
>
> The clippy false positive triggering `new_ret_no_self` lint when using
> `pin_init!` macro is fixed in 1.67, so remove all `#[allow]`s ignoring
> the lint.
>
> Signed-off-by: Gary Guo <gary@garyguo.net>
Applied to `rust-next` with a bit of rewording to add those two links
I mentioned -- thanks everyone!
Cheers,
Miguel
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-10-05 16:35 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-23 2:46 [PATCH] rust: remove ignores for `clippy::new_ret_no_self` Gary Guo
2023-09-23 8:07 ` Benno Lossin
2023-09-23 10:22 ` Finn Behrens
2023-09-23 10:36 ` Miguel Ojeda
2023-09-23 12:01 ` Martin Rodriguez Reboredo
2023-09-23 14:11 ` Alice Ryhl
2023-09-23 15:03 ` Benno Lossin
2023-10-05 16:34 ` 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).