diff options
| author | Albin Babu Varghese <[email protected]> | 2025-05-27 20:49:28 +0000 |
|---|---|---|
| committer | Miguel Ojeda <[email protected]> | 2025-06-23 23:01:12 +0000 |
| commit | b61b0092eaf22ef34936516d2e7181bb9cee25ac (patch) | |
| tree | 3f8383874bdc00085db7dba8ef8dc4fcef6ea0d8 /samples/rust/rust_driver_auxiliary.rs | |
| parent | rust: kunit: use crate-level mapping for `c_void` (diff) | |
| download | kernel-b61b0092eaf22ef34936516d2e7181bb9cee25ac.tar.gz kernel-b61b0092eaf22ef34936516d2e7181bb9cee25ac.zip | |
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 <[email protected]>
Link: https://github.com/Rust-for-Linux/linux/issues/1164
Reviewed-by: Benno Lossin <[email protected]>
Signed-off-by: Albin Babu Varghese <[email protected]>
Reviewed-by: Alice Ryhl <[email protected]>
Reviewed-by: Danilo Krummrich <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
[ Reworded slightly. - Miguel ]
Signed-off-by: Miguel Ojeda <[email protected]>
Diffstat (limited to 'samples/rust/rust_driver_auxiliary.rs')
0 files changed, 0 insertions, 0 deletions
