Rust for Linux List
 help / color / mirror / Atom feed
From: Dirk Behme <dirk.behme@gmail.com>
To: Daniel Sedlak <daniel@sedlak.dev>,
	Miguel Ojeda <ojeda@kernel.org>,
	Alex Gaynor <alex.gaynor@gmail.com>
Cc: "Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	rust-for-linux@vger.kernel.org
Subject: Re: [PATCH 1/2] rust: kernel: init: replace unwraps with the question mark operators
Date: Sun, 17 Nov 2024 08:34:17 +0100	[thread overview]
Message-ID: <702ce883-3d20-45c0-b597-ba55f56d418e@gmail.com> (raw)
In-Reply-To: <20241116195221.373332-2-daniel@sedlak.dev>

Hi Daniel,

On 16.11.24 20:46, Daniel Sedlak wrote:
> Link: https://lore.kernel.org/rust-for-linux/CANiq72nsK1D4NuQ1U7NqMWoYjXkqQSj4QuUEL98OmFbq022Z9A@mail.gmail.com/


While talking about that thread, do you like to cover the dox()
replacement

https://lore.kernel.org/rust-for-linux/459782fe-afca-4fe6-8ffb-ba7c7886de0a@de.bosch.com/

as well?

Thanks for working on this! :)

Dirk


> Suggested-by: Miguel Ojeda <ojeda@kernel.org>
> Signed-off-by: Daniel Sedlak <daniel@sedlak.dev>
> ---
>  rust/kernel/init.rs | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/rust/kernel/init.rs b/rust/kernel/init.rs
> index 347049df556b..81d69d22090c 100644
> --- a/rust/kernel/init.rs
> +++ b/rust/kernel/init.rs
> @@ -1076,8 +1076,9 @@ pub fn uninit<T, E>() -> impl Init<MaybeUninit<T>, E> {
>  /// ```rust
>  /// use kernel::{alloc::KBox, error::Error, init::init_array_from_fn};
>  /// let array: KBox<[usize; 1_000]> =
> -///     KBox::init::<Error>(init_array_from_fn(|i| i), GFP_KERNEL).unwrap();
> +///     KBox::init::<Error>(init_array_from_fn(|i| i), GFP_KERNEL)?;
>  /// assert_eq!(array.len(), 1_000);
> +/// # Ok::<(), Error>(())
>  /// ```
>  pub fn init_array_from_fn<I, const N: usize, T, E>(
>      mut make_init: impl FnMut(usize) -> I,
> @@ -1120,8 +1121,9 @@ pub fn init_array_from_fn<I, const N: usize, T, E>(
>  /// ```rust
>  /// use kernel::{sync::{Arc, Mutex}, init::pin_init_array_from_fn, new_mutex};
>  /// let array: Arc<[Mutex<usize>; 1_000]> =
> -///     Arc::pin_init(pin_init_array_from_fn(|i| new_mutex!(i)), GFP_KERNEL).unwrap();
> +///     Arc::pin_init(pin_init_array_from_fn(|i| new_mutex!(i)), GFP_KERNEL)?;
>  /// assert_eq!(array.len(), 1_000);
> +/// # Ok::<(), Error>(())
>  /// ```
>  pub fn pin_init_array_from_fn<I, const N: usize, T, E>(
>      mut make_init: impl FnMut(usize) -> I,


  reply	other threads:[~2024-11-17  7:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-16 19:46 [PATCH 0/2] Replace unwraps in doctests with graceful handling Daniel Sedlak
2024-11-16 19:46 ` [PATCH 1/2] rust: kernel: init: replace unwraps with the question mark operators Daniel Sedlak
2024-11-17  7:34   ` Dirk Behme [this message]
2024-11-17 17:38     ` Daniel Sedlak
2024-11-16 19:46 ` [PATCH 2/2] rust: kernel: rbtree: replace unwraps with functional programming paradigms Daniel Sedlak
2024-11-16 21:28   ` Miguel Ojeda
2024-11-17 18:36     ` Daniel Sedlak
2024-11-17 20:33       ` Miguel Ojeda
2024-11-18 20:04         ` Daniel Sedlak
2024-11-16 20:01 ` [PATCH 0/2] Replace unwraps in doctests with graceful handling Miguel Ojeda
2024-11-17 17:17   ` Daniel Sedlak
2024-11-17 20:06     ` 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=702ce883-3d20-45c0-b597-ba55f56d418e@gmail.com \
    --to=dirk.behme@gmail.com \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=daniel@sedlak.dev \
    --cc=gary@garyguo.net \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.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