Archive-only list for patches
 help / color / mirror / Atom feed
* [PATCH] rust: uaccess: take advantage of the prelude and `Result`'s defaults
@ 2025-04-29 15:14 Miguel Ojeda
  2025-04-29 15:18 ` Alice Ryhl
  2025-05-12 13:48 ` Miguel Ojeda
  0 siblings, 2 replies; 3+ messages in thread
From: Miguel Ojeda @ 2025-04-29 15:14 UTC (permalink / raw)
  To: Miguel Ojeda, Alex Gaynor
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
	rust-for-linux, linux-kernel, patches

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.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
---
A quick thing I noticed looking at something else...

 rust/kernel/uaccess.rs | 4 +---
 1 file changed, 1 insertion(+), 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 @@
 ///
 /// ```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 @@
 ///
 /// ```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.

base-commit: b4432656b36e5cc1d50a1f2dc15357543add530e
--
2.49.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] rust: uaccess: take advantage of the prelude and `Result`'s defaults
  2025-04-29 15:14 [PATCH] rust: uaccess: take advantage of the prelude and `Result`'s defaults Miguel Ojeda
@ 2025-04-29 15:18 ` Alice Ryhl
  2025-05-12 13:48 ` Miguel Ojeda
  1 sibling, 0 replies; 3+ messages in thread
From: Alice Ryhl @ 2025-04-29 15:18 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Trevor Gross, Danilo Krummrich,
	rust-for-linux, linux-kernel, patches

On Tue, Apr 29, 2025 at 05:14:45PM +0200, Miguel Ojeda wrote:
> 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.
> 
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

Reviewed-by: Alice Ryhl <aliceryhl@google.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rust: uaccess: take advantage of the prelude and `Result`'s defaults
  2025-04-29 15:14 [PATCH] rust: uaccess: take advantage of the prelude and `Result`'s defaults Miguel Ojeda
  2025-04-29 15:18 ` Alice Ryhl
@ 2025-05-12 13:48 ` Miguel Ojeda
  1 sibling, 0 replies; 3+ messages in thread
From: Miguel Ojeda @ 2025-05-12 13:48 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, rust-for-linux, linux-kernel, patches

On Tue, Apr 29, 2025 at 5:15 PM Miguel Ojeda <ojeda@kernel.org> wrote:
>
> 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.
>
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

Applied to `rust-next` -- thanks!

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-05-12 13:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-29 15:14 [PATCH] rust: uaccess: take advantage of the prelude and `Result`'s defaults Miguel Ojeda
2025-04-29 15:18 ` Alice Ryhl
2025-05-12 13:48 ` Miguel Ojeda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox