Files
linux/rust/kernel
Albin Babu Varghese b61b0092ea rust: list: replace unwrap() with ? in doctest examples
Using `unwrap()` in kernel doctests can cause panics on error and may
give newcomers the mistaken impression that panicking is acceptable
in kernel code.

Replace all `.unwrap()` calls in `kernel::list`
examples with `.ok_or(EINVAL)?` so that errors are properly propagated.

Suggested-by: Miguel Ojeda <ojeda@kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1164
Reviewed-by: Benno Lossin <lossin@kernel.org>
Signed-off-by: Albin Babu Varghese <albinbabuvarghese20@gmail.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Danilo Krummrich <dakr@kernel.org>
Link: https://lore.kernel.org/r/20250527204928.5117-1-albinbabuvarghese20@gmail.com
[ Reworded slightly. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2025-06-24 01:01:12 +02:00
..
2025-06-22 23:09:32 +02:00
2025-06-22 23:08:42 +02:00
2025-06-22 23:08:42 +02:00
2025-06-22 23:08:42 +02:00
2025-05-19 12:55:40 +05:30
2025-06-22 23:08:42 +02:00
2025-06-22 23:09:17 +02:00
2025-03-16 21:59:19 +01:00
2025-06-22 23:09:17 +02:00
2025-06-22 23:09:17 +02:00
2025-06-22 23:08:42 +02:00
2025-06-22 23:09:17 +02:00
2024-10-08 15:44:36 +02:00
2025-06-22 23:08:42 +02:00
2025-06-22 23:09:32 +02:00
2025-04-29 15:31:07 +02:00
2024-11-04 16:21:44 -05:00