rust: remove ignores for `clippy::new_ret_no_self`
Subsystems (4)
Gary Guo
maintainerPATCH 1/1 rust: remove ignores for `clippy::new_ret_no_self`
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.
--- rust/kernel/init.rs | 20 ++++++++++---------- rust/kernel/sync/condvar.rs | 1 - rust/kernel/sync/lock.rs | 1 - 3 files changed, 10 insertions(+), 12 deletions(-)
rust/kernel/init.rs +10 -10
@@ -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]
rust/kernel/sync/condvar.rs +0 -1
@@ -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: &'staticCStr , key: &'staticLockClassKey ) ->impl PinInit <Self > {pin_init! (Self { _pin:PhantomPinned ,
rust/kernel/sync/lock.rs +0 -1
@@ -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: &'staticCStr , key: &'staticLockClassKey ) ->impl PinInit <Self > {pin_init! (Self { data:UnsafeCell ::new (t),
Signature · 1 line
2.40.1
Quoted 6 lines · Gary Guo
The clippy false positive triggering
new_ret_no_selflint when usingpin_init!macro is fixed in 1.67, so remove all#[allow]s ignoring the lint.Signed-off-by Gary Guo <[email protected]>---
Quoted 6 lines · Gary Guo
The clippy false positive triggering
new_ret_no_selflint when usingpin_init!macro is fixed in 1.67, so remove all#[allow]s ignoring the lint.Signed-off-by Gary Guo <[email protected]>---
Quoted 4 lines · Gary Guo
The clippy false positive triggering
new_ret_no_selflint when usingpin_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.
Cheers,
Miguel
Quoted 7 lines · Gary Guo
The clippy false positive triggering
new_ret_no_selflint when usingpin_init!macro is fixed in 1.67, so remove all#[allow]s ignoring the lint.Signed-off-by Gary Guo <[email protected]>---
[...]
Quoted 6 lines · Gary Guo
The clippy false positive triggering
new_ret_no_selflint when usingpin_init!macro is fixed in 1.67, so remove all#[allow]s ignoring the lint.Signed-off-by Gary Guo <[email protected]>
Quoted 11 lines · Gary Guo
The clippy false positive triggering
new_ret_no_selflint when usingpin_init!macro is fixed in 1.67, so remove all#[allow]s ignoring the lint.Signed-off-by Gary Guo <[email protected]>--- rust/kernel/init.rs | 20 ++++++++++---------- rust/kernel/sync/condvar.rs | 1 - rust/kernel/sync/lock.rs | 1 - 3 files changed, 10 insertions(+), 12 deletions(-)
Miguel Ojeda
AppliedQuoted 6 lines · Gary Guo
The clippy false positive triggering
new_ret_no_selflint when usingpin_init!macro is fixed in 1.67, so remove all#[allow]s ignoring the lint.Signed-off-by Gary Guo <[email protected]>
Applied to rust-next with a bit of rewording to add those two links I mentioned -- thanks everyone!
Cheers,
Miguel