Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+1 -3
+1 -3
rust/kernel/uaccess.rs
··· 46 46 /// 47 47 /// ```no_run 48 48 /// use kernel::ffi::c_void; 49 - /// use kernel::error::Result; 50 49 /// use kernel::uaccess::{UserPtr, UserSlice}; 51 50 /// 52 - /// fn bytes_add_one(uptr: UserPtr, len: usize) -> Result<()> { 51 + /// fn bytes_add_one(uptr: UserPtr, len: usize) -> Result { 53 52 /// let (read, mut write) = UserSlice::new(uptr, len).reader_writer(); 54 53 /// 55 54 /// let mut buf = KVec::new(); ··· 67 68 /// 68 69 /// ```no_run 69 70 /// use kernel::ffi::c_void; 70 - /// use kernel::error::{code::EINVAL, Result}; 71 71 /// use kernel::uaccess::{UserPtr, UserSlice}; 72 72 /// 73 73 /// /// Returns whether the data in this region is valid.