[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1037016e-d3fc-45a5-9607-38ca85eeb65c@de.bosch.com>
Date: Tue, 17 Sep 2024 10:35:20 +0200
From: Dirk Behme <dirk.behme@...bosch.com>
To: Nell Shamrell-Harrington <nells@...ux.microsoft.com>, <ojeda@...nel.org>,
<alex.gaynor@...il.com>, <wedsonaf@...il.com>
CC: <boqun.feng@...il.com>, <gary@...yguo.net>, <bjorn3_gh@...tonmail.com>,
<benno.lossin@...ton.me>, <a.hindborg@...sung.com>, <aliceryhl@...gle.com>,
<tmgross@...ch.edu>, <linux@...i.io>, <kernel@...entinobst.de>,
<kent.overstreet@...il.com>, <matthew.d.roper@...el.com>,
<kartikprajapati987@...il.com>, <rust-for-linux@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] rust: Adds examples for the `Either` type
On 17.09.2024 01:35, Nell Shamrell-Harrington wrote:
> Adds examples for the `Either` type
You might want to check
https://www.kernel.org/doc/html/latest/process/submitting-patches.html
"Describe your changes in imperative mood, e.g. “make xyzzy do frotz”
instead of “[This patch] makes xyzzy do frotz” or “[I] changed xyzzy to
do frotz”, as if you are giving orders to the codebase to change its
behaviour."
For example:
[PATCH] rust: types: Add examples for the `Either` type
Add examples for the `Either` types.
> Suggested-by: Miguel Ojeda <ojeda@...nel.org>
> Signed-off-by: Nell Shamrell-Harrington <nells@...ux.microsoft.com>
> ---
> rust/kernel/types.rs | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/rust/kernel/types.rs b/rust/kernel/types.rs
> index 9e7ca066355c..f22f6e289198 100644
> --- a/rust/kernel/types.rs
> +++ b/rust/kernel/types.rs
> @@ -461,6 +461,12 @@ fn drop(&mut self) {
> }
>
> /// A sum type that always holds either a value of type `L` or `R`.
It looks to me that the default is to add
/// # Examples
followed by some verbose explanation before the test code below.
> +/// ```
> +/// use kernel::types::Either;
> +///
> +/// let left_value: Either<i32, &str> = Either::Left(7);
> +/// let right_value: Either<i32, &str> = Either::Right("right value");
> +/// ```
I ran that on the the target and got:
# rust_doctest_kernel_types_rs_3.location: rust/kernel/types.rs:485
ok 107 rust_doctest_kernel_types_rs_3
So:
Tested-by: Dirk Behme <dirk.behme@...bosch.com>
Thanks
Dirk
Powered by blists - more mailing lists