public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Benno Lossin" <lossin@kernel.org>
To: "Tamir Duberstein" <tamird@kernel.org>
Cc: "Gary Guo" <gary@garyguo.net>, "Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Fiona Behrens" <me@kloenk.dev>,
	"Christian Schrefl" <chrisi.schrefl@gmail.com>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rust: pin-init: replace clippy `expect` with `allow`
Date: Sun, 15 Feb 2026 19:29:18 +0100	[thread overview]
Message-ID: <DGFQYRT7PDLB.2DI1PA7P11ZVG@kernel.org> (raw)
In-Reply-To: <CAJ-ks9m+ywqeNQ5WM_PN9yxLOka3YQrB__-Vf7Ma3yOa0OcJGQ@mail.gmail.com>

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

  reply	other threads:[~2026-02-15 18:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DGFQYRT7PDLB.2DI1PA7P11ZVG@kernel.org \
    --to=lossin@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=chrisi.schrefl@gmail.com \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=me@kloenk.dev \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox