File tree 2 files changed +15
-0
lines changed
2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -373,3 +373,11 @@ triggered due to non-local changes (such as ``dead_code``).
373
373
For more information about diagnostics in Rust, please see:
374
374
375
375
https://doc.rust-lang.org/stable/reference/attributes/diagnostics.html
376
+
377
+ Error handling
378
+ --------------
379
+
380
+ For some background and guidelines about Rust for Linux specific error handling,
381
+ please see:
382
+
383
+ https://rust.docs.kernel.org/kernel/error/type.Result.html#error-codes-in-c-and-rust
Original file line number Diff line number Diff line change @@ -123,6 +123,13 @@ A current limitation is that KUnit does not support assertions in other tasks.
123
123
Thus, we presently simply print an error to the kernel log if an assertion
124
124
actually failed. Additionally, doctests are not run for nonpublic functions.
125
125
126
+ Since these tests are examples, i.e. they are part of the documentation, they
127
+ should generally be written like "real code". Thus, for example, instead of
128
+ using ``unwrap() `` or ``expect() ``, use the ``? `` operator. For more background,
129
+ please see:
130
+
131
+ https://rust.docs.kernel.org/kernel/error/type.Result.html#error-codes-in-c-and-rust
132
+
126
133
The ``#[test] `` tests
127
134
---------------------
128
135
You can’t perform that action at this time.
0 commit comments