]> git.lizzy.rs Git - rust.git/blob - src/docs/diverging_sub_expression.txt
[Arithmetic] Consider literals
[rust.git] / src / docs / diverging_sub_expression.txt
1 ### What it does
2 Checks for diverging calls that are not match arms or
3 statements.
4
5 ### Why is this bad?
6 It is often confusing to read. In addition, the
7 sub-expression evaluation order for Rust is not well documented.
8
9 ### Known problems
10 Someone might want to use `some_bool || panic!()` as a
11 shorthand.
12
13 ### Example
14 ```
15 let a = b() || panic!() || c();
16 // `c()` is dead, `panic!()` is only called if `b()` returns `false`
17 let x = (a, b, c, panic!());
18 // can simply be replaced by `panic!()`
19 ```