From: Boqun Feng <boqun.feng@gmail.com>
To: manas18244@iiitd.ac.in
Cc: "FUJITA Tomonori" <fujita.tomonori@gmail.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Andrew Lunn" <andrew@lunn.ch>,
"Heiner Kallweit" <hkallweit1@gmail.com>,
"Russell King" <linux@armlinux.org.uk>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <benno.lossin@proton.me>,
"Alice Ryhl" <aliceryhl@google.com>,
"Shuah Khan" <skhan@linuxfoundation.org>,
"Anup Sharma" <anupnewsmail@gmail.com>,
netdev@vger.kernel.org, rust-for-linux@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-block@vger.kernel.org
Subject: Re: [PATCH v3 3/3] rust: macros: simplify Result<()> in function returns
Date: Mon, 18 Nov 2024 12:28:15 -0800 [thread overview]
Message-ID: <ZzujX5dXpUxwBFSU@tardis.local> (raw)
In-Reply-To: <20241118-simplify-result-v3-3-6b1566a77eab@iiitd.ac.in>
On Mon, Nov 18, 2024 at 08:07:00PM +0530, Manas via B4 Relay wrote:
> From: Manas <manas18244@iiitd.ac.in>
>
> Functions foo and bar in doctests return `Result<()>` type. This type
Same nits here.
> can be simply written as `Result` as default type parameters are unit
> `()` and `Error` types. Thus keep the usage of `Result` consistent.
>
> Suggested-by: Miguel Ojeda <ojeda@kernel.org>
> Link: https://github.com/Rust-for-Linux/linux/issues/1128
> Signed-off-by: Manas <manas18244@iiitd.ac.in>
Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Regards,
Boqun
> ---
> rust/macros/lib.rs | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/rust/macros/lib.rs b/rust/macros/lib.rs
> index 4ab94e44adfe3206faad159e81417ea41a35815b..463920353ca9c408f5d69e2626c13a173bae98d7 100644
> --- a/rust/macros/lib.rs
> +++ b/rust/macros/lib.rs
> @@ -144,11 +144,11 @@ pub fn module(ts: TokenStream) -> TokenStream {
> /// // Declares a `#[vtable]` trait
> /// #[vtable]
> /// pub trait Operations: Send + Sync + Sized {
> -/// fn foo(&self) -> Result<()> {
> +/// fn foo(&self) -> Result {
> /// kernel::build_error(VTABLE_DEFAULT_ERROR)
> /// }
> ///
> -/// fn bar(&self) -> Result<()> {
> +/// fn bar(&self) -> Result {
> /// kernel::build_error(VTABLE_DEFAULT_ERROR)
> /// }
> /// }
> @@ -158,7 +158,7 @@ pub fn module(ts: TokenStream) -> TokenStream {
> /// // Implements the `#[vtable]` trait
> /// #[vtable]
> /// impl Operations for Foo {
> -/// fn foo(&self) -> Result<()> {
> +/// fn foo(&self) -> Result {
> /// # Err(EINVAL)
> /// // ...
> /// }
>
> --
> 2.47.0
>
>
next prev parent reply other threads:[~2024-11-18 20:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-18 14:36 [PATCH v3 0/3] rust: simplify Result<()> uses Manas via B4 Relay
2024-11-18 14:36 ` [PATCH v3 1/3] rust: block: simplify Result<()> in validate_block_size return Manas via B4 Relay
2024-11-18 16:05 ` Miguel Ojeda
2024-11-18 16:10 ` Jens Axboe
2024-11-18 16:19 ` Manas
2024-11-18 14:36 ` [PATCH v3 2/3] rust: uaccess: simplify Result<()> in bytes_add_one return Manas via B4 Relay
2024-11-18 20:10 ` Boqun Feng
2024-11-18 14:37 ` [PATCH v3 3/3] rust: macros: simplify Result<()> in function returns Manas via B4 Relay
2024-11-18 20:28 ` Boqun Feng [this message]
2024-11-18 16:11 ` (subset) [PATCH v3 0/3] rust: simplify Result<()> uses Jens Axboe
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=ZzujX5dXpUxwBFSU@tardis.local \
--to=boqun.feng@gmail.com \
--cc=a.hindborg@kernel.org \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=andrew@lunn.ch \
--cc=anupnewsmail@gmail.com \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fujita.tomonori@gmail.com \
--cc=gary@garyguo.net \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=manas18244@iiitd.ac.in \
--cc=netdev@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=pabeni@redhat.com \
--cc=rust-for-linux@vger.kernel.org \
--cc=skhan@linuxfoundation.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;
as well as URLs for NNTP newsgroup(s).