diff options
Diffstat (limited to '')
-rw-r--r-- | src/tools/clippy/src/docs/panic_in_result_fn.txt | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/src/tools/clippy/src/docs/panic_in_result_fn.txt b/src/tools/clippy/src/docs/panic_in_result_fn.txt deleted file mode 100644 index 51c2f8ae5..000000000 --- a/src/tools/clippy/src/docs/panic_in_result_fn.txt +++ /dev/null @@ -1,22 +0,0 @@ -### What it does -Checks for usage of `panic!`, `unimplemented!`, `todo!`, `unreachable!` or assertions in a function of type result. - -### Why is this bad? -For some codebases, it is desirable for functions of type result to return an error instead of crashing. Hence panicking macros should be avoided. - -### Known problems -Functions called from a function returning a `Result` may invoke a panicking macro. This is not checked. - -### Example -``` -fn result_with_panic() -> Result<bool, String> -{ - panic!("error"); -} -``` -Use instead: -``` -fn result_without_panic() -> Result<bool, String> { - Err(String::from("error")) -} -```
\ No newline at end of file |