diff options
author | Miguel Ojeda <ojeda@kernel.org> | 2025-04-29 18:14:45 +0300 |
---|---|---|
committer | Miguel Ojeda <ojeda@kernel.org> | 2025-05-12 01:20:25 +0300 |
commit | 7d8dee4689278e174900509b8c4604651159d8ee (patch) | |
tree | dd5cbe5311d6645725c812b15bee9eee3f1c55dd | |
parent | 0fa5f8c877cae959de7cf6c3dc054e23e7ebcd75 (diff) | |
download | linux-7d8dee4689278e174900509b8c4604651159d8ee.tar.xz |
rust: uaccess: take advantage of the prelude and `Result`'s defaults
The `kernel` prelude brings `Result` and the error codes; and the prelude
itself is already available in the examples automatically.
In addition, `Result` already defaults to `T = ()`.
Thus simplify.
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Link: https://lore.kernel.org/r/20250429151445.438977-1-ojeda@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
-rw-r--r-- | rust/kernel/uaccess.rs | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/rust/kernel/uaccess.rs b/rust/kernel/uaccess.rs index 80a9782b1c6e..7e4c953ba8a1 100644 --- a/rust/kernel/uaccess.rs +++ b/rust/kernel/uaccess.rs @@ -46,10 +46,9 @@ pub type UserPtr = usize; /// /// ```no_run /// use kernel::ffi::c_void; -/// use kernel::error::Result; /// use kernel::uaccess::{UserPtr, UserSlice}; /// -/// fn bytes_add_one(uptr: UserPtr, len: usize) -> Result<()> { +/// fn bytes_add_one(uptr: UserPtr, len: usize) -> Result { /// let (read, mut write) = UserSlice::new(uptr, len).reader_writer(); /// /// let mut buf = KVec::new(); @@ -68,7 +67,6 @@ pub type UserPtr = usize; /// /// ```no_run /// use kernel::ffi::c_void; -/// use kernel::error::{code::EINVAL, Result}; /// use kernel::uaccess::{UserPtr, UserSlice}; /// /// /// Returns whether the data in this region is valid. |