diff options
author | Matthias Beyer <matthias.beyer@ifm.com> | 2022-07-15 10:07:58 +0200 |
---|---|---|
committer | Matthias Beyer <matthias.beyer@ifm.com> | 2022-08-08 08:24:29 +0200 |
commit | a9cf45337452e9770e9085fbc393d076c2ec76d8 (patch) | |
tree | 617a214df16a1e3346cd242527aff27cf5c92ab2 | |
parent | 5577e4dff68ca233938167620c26a12686cf027d (diff) |
Remove paragraph on unrecoverable errorscoding-guidelines-adaption
There should never be a situation when an unrecoverable error happens.
Hence, remove this paragraph.
Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
-rw-r--r-- | CODING_GUIDELINES.md | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/CODING_GUIDELINES.md b/CODING_GUIDELINES.md index 509f599f..6084017f 100644 --- a/CODING_GUIDELINES.md +++ b/CODING_GUIDELINES.md @@ -37,18 +37,5 @@ directory asĀ `mod.rs`. Error handling suggestions follow the [Rust book guidance](https://doc.rust-lang.org/book/ch09-00-error-handling.html). -Recoverable errors should be handled -with [Result](https://doc.rust-lang.org/std/result/). Our suggestions on -unrecoverable errors are listed below: - -* Panic (the code should not panic) -* `unwrap()` - Unwrap should only be used for mutexes (e.g. `lock().unwrap()`) - and test code. For all other use cases, prefer `expect()`. The only exception - is if the error message is custom-generated, in which case use - `.unwrap_or_else(|| panic!("error: {}", foo))` -* `expect()` - Expect should be invoked when a system invariant is expected to - be preserved. `expect()` is preferred over `unwrap()` and should contain a - detailed error message on failure in most cases. -* `assert!()` - This macro is kept in both debug/release and should be used to - protect invariants of the system as necessary. +Errors should be handled with [Result](https://doc.rust-lang.org/std/result/). |