Replace unwraps in doctests with graceful handling
Status from this message: Applied to `rust-next` -- thanks everyone!
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest4 patches 3 repliesApplied
- v24 patches 6 repliesSuperseded
- v12 patches 9 repliesSuperseded
Changes in v3 from the cover letter
- Fix typos in commit messages
- Remove unused import
Patches in v3 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | rust: kernel: init: replace unwraps with the question mark operatorsrust/ | +4 | 1 reply | |
| 2/4 | rust: kernel: rbtree: remove unwrap in assertsrust/ | +23 | 1 reply | |
| 3/4 | rust: kernel: page: remove unnecessary helper function from doctestrust/ | +2 | 0 replies | |
| 4/4 | rust: kernel: str: replace unwraps with the question mark operatorsrust/ | +17 | 0 replies |
Reviews trailers per patch
All 4 patches have a Reviewed-by or Acked-by.
| Patch | Alice Ryhl | Tamir Duberstein |
|---|---|---|
| 1/4 | R-b | |
| 2/4 | R-b | |
| 3/4 | R-b | R-b |
| 4/4 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v3 0/4] Replace unwraps in doctests with graceful handling
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/[email protected]/
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(-)
Signature · 1 line
2.47.0