Skip to content

Commit da968a8

Browse files
committed
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 28729c0 commit da968a8

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

rust/kernel/uaccess.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,9 @@ pub type UserPtr = usize;
4646
///
4747
/// ```no_run
4848
/// use kernel::ffi::c_void;
49-
/// use kernel::error::Result;
5049
/// use kernel::uaccess::{UserPtr, UserSlice};
5150
///
52-
/// fn bytes_add_one(uptr: UserPtr, len: usize) -> Result<()> {
51+
/// fn bytes_add_one(uptr: UserPtr, len: usize) -> Result {
5352
/// let (read, mut write) = UserSlice::new(uptr, len).reader_writer();
5453
///
5554
/// let mut buf = KVec::new();
@@ -68,7 +67,6 @@ pub type UserPtr = usize;
6867
///
6968
/// ```no_run
7069
/// use kernel::ffi::c_void;
71-
/// use kernel::error::{code::EINVAL, Result};
7270
/// use kernel::uaccess::{UserPtr, UserSlice};
7371
///
7472
/// /// Returns whether the data in this region is valid.

0 commit comments

Comments
 (0)