]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/src/docs/panicking_unwrap.txt
Rollup merge of #102470 - est31:stabilize_const_char_convert, r=joshtriplett
[rust.git] / src / tools / clippy / src / docs / panicking_unwrap.txt
1 ### What it does
2 Checks for calls of `unwrap[_err]()` that will always fail.
3
4 ### Why is this bad?
5 If panicking is desired, an explicit `panic!()` should be used.
6
7 ### Known problems
8 This lint only checks `if` conditions not assignments.
9 So something like `let x: Option<()> = None; x.unwrap();` will not be recognized.
10
11 ### Example
12 ```
13 if option.is_none() {
14     do_something_with(option.unwrap())
15 }
16 ```
17
18 This code will always panic. The if condition should probably be inverted.