diff mbox series

[v2,3/3] rust: macros: simplify Result<()> in function returns

Message ID 20241118-simplify-result-v2-3-9d280ada516d@iiitd.ac.in (mailing list archive)
State Superseded
Headers show
Series rust: simplify Result<()> uses | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Manas via B4 Relay Nov. 18, 2024, 1:12 p.m. UTC
From: Manas <manas18244@iiitd.ac.in>

Functions foo and bar in doctests return `Result<()>` type. This type
can be simply written as `Result` as default type parameters are unit
`()` and `Error` types. This also keeps the usage of `Result`
consistent.

Signed-off-by: Manas <manas18244@iiitd.ac.in>
---
 rust/macros/lib.rs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

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)
 ///         // ...
 ///     }