[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANiq72mhz9iXGTPbVmKdD1Lpf7wq5abpB0KkiAL-2zUAa24s_w@mail.gmail.com>
Date: Tue, 24 Jun 2025 01:12:23 +0200
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Albin Babu Varghese <albinbabuvarghese20@...il.com>
Cc: ojeda@...nel.org, alex.gaynor@...il.com, boqun.feng@...il.com,
gary@...yguo.net, bjorn3_gh@...tonmail.com, lossin@...nel.org,
a.hindborg@...nel.org, aliceryhl@...gle.com, tmgross@...ch.edu,
dakr@...nel.org, rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] rust/list: replace unwrap() with ? in doctest examples
On Tue, May 27, 2025 at 10:52 PM Albin Babu Varghese
<albinbabuvarghese20@...il.com> wrote:
>
> Using `unwrap()` in kernel doctests can cause panics on error and may
> give newcomers the mistaken impression that panicking is acceptable
> in kernel code.
>
> Replace all `.unwrap()` calls in `kernel::list`
> examples with `.ok_or(EINVAL)?` so that errors are properly propagated.
>
> Closes: https://github.com/Rust-for-Linux/linux/issues/1164
> Suggested-by: Miguel Ojeda <ojeda@...nel.org>
> Reviewed-by: Benno Lossin <lossin@...nel.org>
> Link: https://github.com/Rust-for-Linux/linux/issues/1164
> Signed-off-by: Albin Babu Varghese <albinbabuvarghese20@...il.com>
Applied to `rust-next` -- thanks everyone!
[ Reworded slightly. - Miguel ]
Cheers,
Miguel
Powered by blists - more mailing lists