All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/4] Replace unwraps in doctests with graceful handling
@ 2024-11-23  9:50 Daniel Sedlak
  2024-11-23  9:50 ` [PATCH v3 1/4] rust: kernel: init: replace unwraps with the question mark operators Daniel Sedlak
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Daniel Sedlak @ 2024-11-23  9:50 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, rust-for-linux,
	Tamir Duberstein, Daniel Sedlak

In the following patches, I touch on error handling in the documentation
tests/examples. There are multiple occurrences of unwraps which can be
replaced by a question mark operator which should simplify the code.
Also, people typically tend to copy & paste code from the examples
(citation needed). If we leave the unwraps there, I think we can convey
the wrong impression, that it is OK to use unwraps unless the programmer
has a really good reason to use them.

Changes since v2:
- Fix typos in commit messages
- Remove unused import

Changes since RFC/v1:
- Remove opinionated changes from `rust/kernel/rbtree.rs`.
- Run clippy
- Add description to each commit message body with rationale.
- Link to RFC/v1: https://lore.kernel.org/rust-for-linux/20241116195221.373332-1-daniel@sedlak.dev/

Daniel Sedlak (4):
  rust: kernel: init: replace unwraps with the question mark operators
  rust: kernel: rbtree: remove unwrap in asserts
  rust: kernel: page: remove unnecessary helper function from doctest
  rust: kernel: str: replace unwraps with the question mark operators

 rust/kernel/init.rs   |  6 ++++--
 rust/kernel/page.rs   |  6 ++----
 rust/kernel/rbtree.rs | 46 +++++++++++++++++++++----------------------
 rust/kernel/str.rs    | 28 +++++++++++++++-----------
 4 files changed, 46 insertions(+), 40 deletions(-)

-- 
2.47.0


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

end of thread, other threads:[~2025-01-13 14:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-23  9:50 [PATCH v3 0/4] Replace unwraps in doctests with graceful handling Daniel Sedlak
2024-11-23  9:50 ` [PATCH v3 1/4] rust: kernel: init: replace unwraps with the question mark operators Daniel Sedlak
2024-11-25  9:04   ` Alice Ryhl
2024-11-23  9:50 ` [PATCH v3 2/4] rust: kernel: rbtree: remove unwrap in asserts Daniel Sedlak
2024-11-25  9:03   ` Alice Ryhl
2024-11-23  9:50 ` [PATCH v3 3/4] rust: kernel: page: remove unnecessary helper function from doctest Daniel Sedlak
2024-11-23  9:50 ` [PATCH v3 4/4] rust: kernel: str: replace unwraps with the question mark operators Daniel Sedlak
2025-01-13 14:42 ` [PATCH v3 0/4] Replace unwraps in doctests with graceful handling Miguel Ojeda

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.