public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rust: pin-init: replace clippy `expect` with `allow`
@ 2026-02-15 13:22 Benno Lossin
  2026-02-15 14:24 ` Tamir Duberstein
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Benno Lossin @ 2026-02-15 13:22 UTC (permalink / raw)
  To: Benno Lossin, Gary Guo, Miguel Ojeda, Boqun Feng,
	Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Fiona Behrens, Christian Schrefl
  Cc: rust-for-linux, linux-kernel

`clippy` has changed behavior in [1] (Rust 1.95) where it no longer
warns about the `let_and_return` lint when a comment is placed between
the let binding and the return expression. Nightly thus fails to build,
because the expectation is no longer fulfilled.

Thus replace the expectation with an `allow`.

Link: https://github.com/rust-lang/rust-clippy/pull/16461 [1]
Signed-off-by: Benno Lossin <lossin@kernel.org>
---
 rust/pin-init/src/lib.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rust/pin-init/src/lib.rs b/rust/pin-init/src/lib.rs
index 49945fc07f25..fe4c85ae3f02 100644
--- a/rust/pin-init/src/lib.rs
+++ b/rust/pin-init/src/lib.rs
@@ -1143,13 +1143,13 @@ unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), E> {
 ///
 /// - `*mut U` must be castable to `*mut T` and any value of type `T` written through such a
 ///   pointer must result in a valid `U`.
-#[expect(clippy::let_and_return)]
 pub const unsafe fn cast_pin_init<T, U, E>(init: impl PinInit<T, E>) -> impl PinInit<U, E> {
     // SAFETY: initialization delegated to a valid initializer. Cast is valid by function safety
     // requirements.
     let res = unsafe { pin_init_from_closure(|ptr: *mut U| init.__pinned_init(ptr.cast::<T>())) };
     // FIXME: remove the let statement once the nightly-MSRV allows it (1.78 otherwise encounters a
     // cycle when computing the type returned by this function)
+    #[allow(clippy::let_and_return)]
     res
 }
 
@@ -1159,13 +1159,13 @@ unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), E> {
 ///
 /// - `*mut U` must be castable to `*mut T` and any value of type `T` written through such a
 ///   pointer must result in a valid `U`.
-#[expect(clippy::let_and_return)]
 pub const unsafe fn cast_init<T, U, E>(init: impl Init<T, E>) -> impl Init<U, E> {
     // SAFETY: initialization delegated to a valid initializer. Cast is valid by function safety
     // requirements.
     let res = unsafe { init_from_closure(|ptr: *mut U| init.__init(ptr.cast::<T>())) };
     // FIXME: remove the let statement once the nightly-MSRV allows it (1.78 otherwise encounters a
     // cycle when computing the type returned by this function)
+    #[allow(clippy::let_and_return)]
     res
 }
 

base-commit: ca4ee40bf13dbd3a4be3b40a00c33a1153d487e5
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] rust: pin-init: replace clippy `expect` with `allow`
  2026-02-15 13:22 [PATCH] rust: pin-init: replace clippy `expect` with `allow` Benno Lossin
@ 2026-02-15 14:24 ` Tamir Duberstein
  2026-02-15 14:57   ` Benno Lossin
  2026-02-16  1:36 ` Gary Guo
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Tamir Duberstein @ 2026-02-15 14:24 UTC (permalink / raw)
  To: Benno Lossin
  Cc: Gary Guo, Miguel Ojeda, Boqun Feng, Björn Roy Baron,
	Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
	Fiona Behrens, Christian Schrefl, rust-for-linux, linux-kernel

On Sun, Feb 15, 2026 at 8:22 AM Benno Lossin <lossin@kernel.org> wrote:
>
> `clippy` has changed behavior in [1] (Rust 1.95) where it no longer
> warns about the `let_and_return` lint when a comment is placed between
> the let binding and the return expression. Nightly thus fails to build,
> because the expectation is no longer fulfilled.
>
> Thus replace the expectation with an `allow`.
>
> Link: https://github.com/rust-lang/rust-clippy/pull/16461 [1]
> Signed-off-by: Benno Lossin <lossin@kernel.org>
> ---
>  rust/pin-init/src/lib.rs | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/rust/pin-init/src/lib.rs b/rust/pin-init/src/lib.rs
> index 49945fc07f25..fe4c85ae3f02 100644
> --- a/rust/pin-init/src/lib.rs
> +++ b/rust/pin-init/src/lib.rs
> @@ -1143,13 +1143,13 @@ unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), E> {
>  ///
>  /// - `*mut U` must be castable to `*mut T` and any value of type `T` written through such a
>  ///   pointer must result in a valid `U`.
> -#[expect(clippy::let_and_return)]
>  pub const unsafe fn cast_pin_init<T, U, E>(init: impl PinInit<T, E>) -> impl PinInit<U, E> {
>      // SAFETY: initialization delegated to a valid initializer. Cast is valid by function safety
>      // requirements.
>      let res = unsafe { pin_init_from_closure(|ptr: *mut U| init.__pinned_init(ptr.cast::<T>())) };
>      // FIXME: remove the let statement once the nightly-MSRV allows it (1.78 otherwise encounters a
>      // cycle when computing the type returned by this function)
> +    #[allow(clippy::let_and_return)]

Consider adding `reason = "..."`.

>      res
>  }
>
> @@ -1159,13 +1159,13 @@ unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), E> {
>  ///
>  /// - `*mut U` must be castable to `*mut T` and any value of type `T` written through such a
>  ///   pointer must result in a valid `U`.
> -#[expect(clippy::let_and_return)]
>  pub const unsafe fn cast_init<T, U, E>(init: impl Init<T, E>) -> impl Init<U, E> {
>      // SAFETY: initialization delegated to a valid initializer. Cast is valid by function safety
>      // requirements.
>      let res = unsafe { init_from_closure(|ptr: *mut U| init.__init(ptr.cast::<T>())) };
>      // FIXME: remove the let statement once the nightly-MSRV allows it (1.78 otherwise encounters a
>      // cycle when computing the type returned by this function)
> +    #[allow(clippy::let_and_return)]

Consider adding `reason = "..."`.

>      res
>  }
>
>
> base-commit: ca4ee40bf13dbd3a4be3b40a00c33a1153d487e5
> --
> 2.52.0
>
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] rust: pin-init: replace clippy `expect` with `allow`
  2026-02-15 14:24 ` Tamir Duberstein
@ 2026-02-15 14:57   ` Benno Lossin
  2026-02-15 15:19     ` Tamir Duberstein
  0 siblings, 1 reply; 11+ messages in thread
From: Benno Lossin @ 2026-02-15 14:57 UTC (permalink / raw)
  To: Tamir Duberstein
  Cc: Gary Guo, Miguel Ojeda, Boqun Feng, Björn Roy Baron,
	Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
	Fiona Behrens, Christian Schrefl, rust-for-linux, linux-kernel

On Sun Feb 15, 2026 at 3:24 PM CET, Tamir Duberstein wrote:
> On Sun, Feb 15, 2026 at 8:22 AM Benno Lossin <lossin@kernel.org> wrote:
>>
>> `clippy` has changed behavior in [1] (Rust 1.95) where it no longer
>> warns about the `let_and_return` lint when a comment is placed between
>> the let binding and the return expression. Nightly thus fails to build,
>> because the expectation is no longer fulfilled.
>>
>> Thus replace the expectation with an `allow`.
>>
>> Link: https://github.com/rust-lang/rust-clippy/pull/16461 [1]
>> Signed-off-by: Benno Lossin <lossin@kernel.org>
>> ---
>>  rust/pin-init/src/lib.rs | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/rust/pin-init/src/lib.rs b/rust/pin-init/src/lib.rs
>> index 49945fc07f25..fe4c85ae3f02 100644
>> --- a/rust/pin-init/src/lib.rs
>> +++ b/rust/pin-init/src/lib.rs
>> @@ -1143,13 +1143,13 @@ unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), E> {
>>  ///
>>  /// - `*mut U` must be castable to `*mut T` and any value of type `T` written through such a
>>  ///   pointer must result in a valid `U`.
>> -#[expect(clippy::let_and_return)]
>>  pub const unsafe fn cast_pin_init<T, U, E>(init: impl PinInit<T, E>) -> impl PinInit<U, E> {
>>      // SAFETY: initialization delegated to a valid initializer. Cast is valid by function safety
>>      // requirements.
>>      let res = unsafe { pin_init_from_closure(|ptr: *mut U| init.__pinned_init(ptr.cast::<T>())) };
>>      // FIXME: remove the let statement once the nightly-MSRV allows it (1.78 otherwise encounters a
>>      // cycle when computing the type returned by this function)
>> +    #[allow(clippy::let_and_return)]
>
> Consider adding `reason = "..."`.

Isn't the FIXME comment directly above enough? I don't want to duplicate
the information and the string constant explaining the reason looks
ugly.

Cheers,
Benno

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] rust: pin-init: replace clippy `expect` with `allow`
  2026-02-15 14:57   ` Benno Lossin
@ 2026-02-15 15:19     ` Tamir Duberstein
  2026-02-15 18:29       ` Benno Lossin
  0 siblings, 1 reply; 11+ messages in thread
From: Tamir Duberstein @ 2026-02-15 15:19 UTC (permalink / raw)
  To: Benno Lossin
  Cc: Gary Guo, Miguel Ojeda, Boqun Feng, Björn Roy Baron,
	Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
	Fiona Behrens, Christian Schrefl, rust-for-linux, linux-kernel

On Sun, Feb 15, 2026 at 9:57 AM Benno Lossin <lossin@kernel.org> wrote:
>
> On Sun Feb 15, 2026 at 3:24 PM CET, Tamir Duberstein wrote:
> > On Sun, Feb 15, 2026 at 8:22 AM Benno Lossin <lossin@kernel.org> wrote:
> >>
> >> `clippy` has changed behavior in [1] (Rust 1.95) where it no longer
> >> warns about the `let_and_return` lint when a comment is placed between
> >> the let binding and the return expression. Nightly thus fails to build,
> >> because the expectation is no longer fulfilled.
> >>
> >> Thus replace the expectation with an `allow`.
> >>
> >> Link: https://github.com/rust-lang/rust-clippy/pull/16461 [1]
> >> Signed-off-by: Benno Lossin <lossin@kernel.org>
> >> ---
> >>  rust/pin-init/src/lib.rs | 4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/rust/pin-init/src/lib.rs b/rust/pin-init/src/lib.rs
> >> index 49945fc07f25..fe4c85ae3f02 100644
> >> --- a/rust/pin-init/src/lib.rs
> >> +++ b/rust/pin-init/src/lib.rs
> >> @@ -1143,13 +1143,13 @@ unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), E> {
> >>  ///
> >>  /// - `*mut U` must be castable to `*mut T` and any value of type `T` written through such a
> >>  ///   pointer must result in a valid `U`.
> >> -#[expect(clippy::let_and_return)]
> >>  pub const unsafe fn cast_pin_init<T, U, E>(init: impl PinInit<T, E>) -> impl PinInit<U, E> {
> >>      // SAFETY: initialization delegated to a valid initializer. Cast is valid by function safety
> >>      // requirements.
> >>      let res = unsafe { pin_init_from_closure(|ptr: *mut U| init.__pinned_init(ptr.cast::<T>())) };
> >>      // FIXME: remove the let statement once the nightly-MSRV allows it (1.78 otherwise encounters a
> >>      // cycle when computing the type returned by this function)
> >> +    #[allow(clippy::let_and_return)]
> >
> > Consider adding `reason = "..."`.
>
> Isn't the FIXME comment directly above enough? I don't want to duplicate
> the information and the string constant explaining the reason looks
> ugly.

The FIXME explains why the allowance is needed, but it doesn't explain
why it is an allow rather than an expect.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] rust: pin-init: replace clippy `expect` with `allow`
  2026-02-15 15:19     ` Tamir Duberstein
@ 2026-02-15 18:29       ` Benno Lossin
  0 siblings, 0 replies; 11+ messages in thread
From: Benno Lossin @ 2026-02-15 18:29 UTC (permalink / raw)
  To: Tamir Duberstein
  Cc: Gary Guo, Miguel Ojeda, Boqun Feng, Björn Roy Baron,
	Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
	Fiona Behrens, Christian Schrefl, rust-for-linux, linux-kernel

On Sun Feb 15, 2026 at 4:19 PM CET, Tamir Duberstein wrote:
> On Sun, Feb 15, 2026 at 9:57 AM Benno Lossin <lossin@kernel.org> wrote:
>> On Sun Feb 15, 2026 at 3:24 PM CET, Tamir Duberstein wrote:
>> > On Sun, Feb 15, 2026 at 8:22 AM Benno Lossin <lossin@kernel.org> wrote:
>> >> @@ -1143,13 +1143,13 @@ unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), E> {
>> >>  ///
>> >>  /// - `*mut U` must be castable to `*mut T` and any value of type `T` written through such a
>> >>  ///   pointer must result in a valid `U`.
>> >> -#[expect(clippy::let_and_return)]
>> >>  pub const unsafe fn cast_pin_init<T, U, E>(init: impl PinInit<T, E>) -> impl PinInit<U, E> {
>> >>      // SAFETY: initialization delegated to a valid initializer. Cast is valid by function safety
>> >>      // requirements.
>> >>      let res = unsafe { pin_init_from_closure(|ptr: *mut U| init.__pinned_init(ptr.cast::<T>())) };
>> >>      // FIXME: remove the let statement once the nightly-MSRV allows it (1.78 otherwise encounters a
>> >>      // cycle when computing the type returned by this function)
>> >> +    #[allow(clippy::let_and_return)]
>> >
>> > Consider adding `reason = "..."`.
>>
>> Isn't the FIXME comment directly above enough? I don't want to duplicate
>> the information and the string constant explaining the reason looks
>> ugly.
>
> The FIXME explains why the allowance is needed, but it doesn't explain
> why it is an allow rather than an expect.

I don't see much value in documenting that in the code. This'll be
removed once we raise the MSRV, which should happen later this year. If
one really wants to know why it's there, there is the git log.

Cheers,
Benno

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] rust: pin-init: replace clippy `expect` with `allow`
  2026-02-15 13:22 [PATCH] rust: pin-init: replace clippy `expect` with `allow` Benno Lossin
  2026-02-15 14:24 ` Tamir Duberstein
@ 2026-02-16  1:36 ` Gary Guo
  2026-02-16 11:17   ` Benno Lossin
  2026-02-16 14:24 ` Miguel Ojeda
  2026-02-19  8:37 ` Miguel Ojeda
  3 siblings, 1 reply; 11+ messages in thread
From: Gary Guo @ 2026-02-16  1:36 UTC (permalink / raw)
  To: Benno Lossin
  Cc: Miguel Ojeda, Boqun Feng, Björn Roy Baron, Andreas Hindborg,
	Alice Ryhl, Trevor Gross, Danilo Krummrich, Fiona Behrens,
	Christian Schrefl, rust-for-linux, linux-kernel

On 2026-02-15 13:22, Benno Lossin wrote:
> `clippy` has changed behavior in [1] (Rust 1.95) where it no longer
> warns about the `let_and_return` lint when a comment is placed between
> the let binding and the return expression. Nightly thus fails to build,
> because the expectation is no longer fulfilled.
> 
> Thus replace the expectation with an `allow`.
> 
> Link: https://github.com/rust-lang/rust-clippy/pull/16461 [1]
> Signed-off-by: Benno Lossin <lossin@kernel.org>

I think it's worth adding a comment (or reason) that this is no longer needed after 1.95.

With that:

Reviewed-by: Gary Guo <gary@garyguo.net>

> ---
>  rust/pin-init/src/lib.rs | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/rust/pin-init/src/lib.rs b/rust/pin-init/src/lib.rs
> index 49945fc07f25..fe4c85ae3f02 100644
> --- a/rust/pin-init/src/lib.rs
> +++ b/rust/pin-init/src/lib.rs
> @@ -1143,13 +1143,13 @@ unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), E> {
>  ///
>  /// - `*mut U` must be castable to `*mut T` and any value of type `T` written through such a
>  ///   pointer must result in a valid `U`.
> -#[expect(clippy::let_and_return)]
>  pub const unsafe fn cast_pin_init<T, U, E>(init: impl PinInit<T, E>) -> impl PinInit<U, E> {
>      // SAFETY: initialization delegated to a valid initializer. Cast is valid by function safety
>      // requirements.
>      let res = unsafe { pin_init_from_closure(|ptr: *mut U| init.__pinned_init(ptr.cast::<T>())) };
>      // FIXME: remove the let statement once the nightly-MSRV allows it (1.78 otherwise encounters a
>      // cycle when computing the type returned by this function)
> +    #[allow(clippy::let_and_return)]
>      res
>  }
>  
> @@ -1159,13 +1159,13 @@ unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), E> {
>  ///
>  /// - `*mut U` must be castable to `*mut T` and any value of type `T` written through such a
>  ///   pointer must result in a valid `U`.
> -#[expect(clippy::let_and_return)]
>  pub const unsafe fn cast_init<T, U, E>(init: impl Init<T, E>) -> impl Init<U, E> {
>      // SAFETY: initialization delegated to a valid initializer. Cast is valid by function safety
>      // requirements.
>      let res = unsafe { init_from_closure(|ptr: *mut U| init.__init(ptr.cast::<T>())) };
>      // FIXME: remove the let statement once the nightly-MSRV allows it (1.78 otherwise encounters a
>      // cycle when computing the type returned by this function)
> +    #[allow(clippy::let_and_return)]
>      res
>  }
>  
> 
> base-commit: ca4ee40bf13dbd3a4be3b40a00c33a1153d487e5

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] rust: pin-init: replace clippy `expect` with `allow`
  2026-02-16  1:36 ` Gary Guo
@ 2026-02-16 11:17   ` Benno Lossin
  2026-02-18 15:08     ` Gary Guo
  0 siblings, 1 reply; 11+ messages in thread
From: Benno Lossin @ 2026-02-16 11:17 UTC (permalink / raw)
  To: Gary Guo
  Cc: Miguel Ojeda, Boqun Feng, Björn Roy Baron, Andreas Hindborg,
	Alice Ryhl, Trevor Gross, Danilo Krummrich, Fiona Behrens,
	Christian Schrefl, rust-for-linux, linux-kernel

On Mon Feb 16, 2026 at 2:36 AM CET, Gary Guo wrote:
> On 2026-02-15 13:22, Benno Lossin wrote:
>> `clippy` has changed behavior in [1] (Rust 1.95) where it no longer
>> warns about the `let_and_return` lint when a comment is placed between
>> the let binding and the return expression. Nightly thus fails to build,
>> because the expectation is no longer fulfilled.
>> 
>> Thus replace the expectation with an `allow`.
>> 
>> Link: https://github.com/rust-lang/rust-clippy/pull/16461 [1]
>> Signed-off-by: Benno Lossin <lossin@kernel.org>
>
> I think it's worth adding a comment (or reason) that this is no longer needed after 1.95.

We'll remove the let binding when we raise the MSRV above 1.78 and then
the `allow` should also be gone. Do you still want me to add it?

Cheers,
Benno

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] rust: pin-init: replace clippy `expect` with `allow`
  2026-02-15 13:22 [PATCH] rust: pin-init: replace clippy `expect` with `allow` Benno Lossin
  2026-02-15 14:24 ` Tamir Duberstein
  2026-02-16  1:36 ` Gary Guo
@ 2026-02-16 14:24 ` Miguel Ojeda
  2026-02-19  8:37 ` Miguel Ojeda
  3 siblings, 0 replies; 11+ messages in thread
From: Miguel Ojeda @ 2026-02-16 14:24 UTC (permalink / raw)
  To: Benno Lossin
  Cc: Gary Guo, Miguel Ojeda, Boqun Feng, Björn Roy Baron,
	Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
	Fiona Behrens, Christian Schrefl, rust-for-linux, linux-kernel

As we discaOn Sun, Feb 15, 2026 at 2:22 PM Benno Lossin
<lossin@kernel.org> wrote:
>
> `clippy` has changed behavior in [1] (Rust 1.95) where it no longer
> warns about the `let_and_return` lint when a comment is placed between
> the let binding and the return expression. Nightly thus fails to build,
> because the expectation is no longer fulfilled.
>
> Thus replace the expectation with an `allow`.
>
> Link: https://github.com/rust-lang/rust-clippy/pull/16461 [1]
> Signed-off-by: Benno Lossin <lossin@kernel.org>

Thanks for figuring out the PR upstream, that is always helpful -- I
also noticed it in the 2026-02-13 nightly, so this saved me having to
dig into it.

If you want, when you decide it is ready, I can take it into rust-fixes.

By the way, if you send a new version, please include the error -- it
makes it easier for others to find it later in lore.kernel.org. In
case you don't have it around, this is what I got in that run from a
few days ago:

    error: this lint expectation is unfulfilled
        --> rust/pin-init/src/lib.rs:1279:10
         |
    1279 | #[expect(clippy::let_and_return)]
         |          ^^^^^^^^^^^^^^^^^^^^^^
         |
         = note: `-D unfulfilled-lint-expectations` implied by `-D warnings`
         = help: to override `-D warnings` add
`#[allow(unfulfilled_lint_expectations)]`

    error: this lint expectation is unfulfilled
        --> rust/pin-init/src/lib.rs:1295:10
         |
    1295 | #[expect(clippy::let_and_return)]
         |          ^^^^^^^^^^^^^^^^^^^^^^

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] rust: pin-init: replace clippy `expect` with `allow`
  2026-02-16 11:17   ` Benno Lossin
@ 2026-02-18 15:08     ` Gary Guo
  2026-02-18 20:38       ` Benno Lossin
  0 siblings, 1 reply; 11+ messages in thread
From: Gary Guo @ 2026-02-18 15:08 UTC (permalink / raw)
  To: Benno Lossin
  Cc: Miguel Ojeda, Boqun Feng, Björn Roy Baron, Andreas Hindborg,
	Alice Ryhl, Trevor Gross, Danilo Krummrich, Fiona Behrens,
	Christian Schrefl, rust-for-linux, linux-kernel

On 2026-02-16 11:17, Benno Lossin wrote:
> On Mon Feb 16, 2026 at 2:36 AM CET, Gary Guo wrote:
>> On 2026-02-15 13:22, Benno Lossin wrote:
>>> `clippy` has changed behavior in [1] (Rust 1.95) where it no longer
>>> warns about the `let_and_return` lint when a comment is placed 
>>> between
>>> the let binding and the return expression. Nightly thus fails to 
>>> build,
>>> because the expectation is no longer fulfilled.
>>> 
>>> Thus replace the expectation with an `allow`.
>>> 
>>> Link: https://github.com/rust-lang/rust-clippy/pull/16461 [1]
>>> Signed-off-by: Benno Lossin <lossin@kernel.org>
>> 
>> I think it's worth adding a comment (or reason) that this is no longer 
>> needed after 1.95.
> 
> We'll remove the let binding when we raise the MSRV above 1.78 and then
> the `allow` should also be gone. Do you still want me to add it?
> 
> Cheers,
> Benno

The existing comment just says that the bug exists in 1.78. So is it 
fixed in 1.79+? If so,
please update the comment to say the MSRV that this is no longer needed, 
then I'm fine
without reason for clippy allow.

Best,
Gary

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] rust: pin-init: replace clippy `expect` with `allow`
  2026-02-18 15:08     ` Gary Guo
@ 2026-02-18 20:38       ` Benno Lossin
  0 siblings, 0 replies; 11+ messages in thread
From: Benno Lossin @ 2026-02-18 20:38 UTC (permalink / raw)
  To: Gary Guo
  Cc: Miguel Ojeda, Boqun Feng, Björn Roy Baron, Andreas Hindborg,
	Alice Ryhl, Trevor Gross, Danilo Krummrich, Fiona Behrens,
	Christian Schrefl, rust-for-linux, linux-kernel

On Wed Feb 18, 2026 at 4:08 PM CET, Gary Guo wrote:
> On 2026-02-16 11:17, Benno Lossin wrote:
>> On Mon Feb 16, 2026 at 2:36 AM CET, Gary Guo wrote:
>>> On 2026-02-15 13:22, Benno Lossin wrote:
>>>> `clippy` has changed behavior in [1] (Rust 1.95) where it no longer
>>>> warns about the `let_and_return` lint when a comment is placed 
>>>> between
>>>> the let binding and the return expression. Nightly thus fails to 
>>>> build,
>>>> because the expectation is no longer fulfilled.
>>>> 
>>>> Thus replace the expectation with an `allow`.
>>>> 
>>>> Link: https://github.com/rust-lang/rust-clippy/pull/16461 [1]
>>>> Signed-off-by: Benno Lossin <lossin@kernel.org>
>>> 
>>> I think it's worth adding a comment (or reason) that this is no longer 
>>> needed after 1.95.
>> 
>> We'll remove the let binding when we raise the MSRV above 1.78 and then
>> the `allow` should also be gone. Do you still want me to add it?
>> 
>> Cheers,
>> Benno
>
> The existing comment just says that the bug exists in 1.78. So is it 
> fixed in 1.79+? If so,
> please update the comment to say the MSRV that this is no longer needed, 
> then I'm fine
> without reason for clippy allow.

We discussed this in the meeting, Miguel will pick this patch as-is and
I'll send a follow up to change the comment.

Cheers,
Benno

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] rust: pin-init: replace clippy `expect` with `allow`
  2026-02-15 13:22 [PATCH] rust: pin-init: replace clippy `expect` with `allow` Benno Lossin
                   ` (2 preceding siblings ...)
  2026-02-16 14:24 ` Miguel Ojeda
@ 2026-02-19  8:37 ` Miguel Ojeda
  3 siblings, 0 replies; 11+ messages in thread
From: Miguel Ojeda @ 2026-02-19  8:37 UTC (permalink / raw)
  To: Benno Lossin, Gary Guo
  Cc: Miguel Ojeda, Boqun Feng, Björn Roy Baron, Andreas Hindborg,
	Alice Ryhl, Trevor Gross, Danilo Krummrich, Fiona Behrens,
	Christian Schrefl, rust-for-linux, linux-kernel

On Sun, Feb 15, 2026 at 2:22 PM Benno Lossin <lossin@kernel.org> wrote:
>
> `clippy` has changed behavior in [1] (Rust 1.95) where it no longer
> warns about the `let_and_return` lint when a comment is placed between
> the let binding and the return expression. Nightly thus fails to build,
> because the expectation is no longer fulfilled.
>
> Thus replace the expectation with an `allow`.
>
> Link: https://github.com/rust-lang/rust-clippy/pull/16461 [1]
> Signed-off-by: Benno Lossin <lossin@kernel.org>

Applied to `rust-fixes` -- thanks everyone!

Gary: I wasn't sure if you would have wanted me to pick your tag,
since it was conditional to adding the message, but we agreed to add
it later on. Just in case, I didn't add it to be on the safe side, but
I can add it.

By the way, I added:

  Cc: stable@vger.kernel.org # Needed in 6.18.y and later.

    [ The errors were:

          error: this lint expectation is unfulfilled
              --> rust/pin-init/src/lib.rs:1279:10
               |
          1279 | #[expect(clippy::let_and_return)]
               |          ^^^^^^^^^^^^^^^^^^^^^^
               |
               = note: `-D unfulfilled-lint-expectations` implied by
`-D warnings`
               = help: to override `-D warnings` add
`#[allow(unfulfilled_lint_expectations)]`

          error: this lint expectation is unfulfilled
              --> rust/pin-init/src/lib.rs:1295:10
               |
          1295 | #[expect(clippy::let_and_return)]
               |          ^^^^^^^^^^^^^^^^^^^^^^

        - Miguel ]

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-02-19  8:37 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-15 13:22 [PATCH] rust: pin-init: replace clippy `expect` with `allow` Benno Lossin
2026-02-15 14:24 ` Tamir Duberstein
2026-02-15 14:57   ` Benno Lossin
2026-02-15 15:19     ` Tamir Duberstein
2026-02-15 18:29       ` Benno Lossin
2026-02-16  1:36 ` Gary Guo
2026-02-16 11:17   ` Benno Lossin
2026-02-18 15:08     ` Gary Guo
2026-02-18 20:38       ` Benno Lossin
2026-02-16 14:24 ` Miguel Ojeda
2026-02-19  8:37 ` Miguel Ojeda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox