diff options
Diffstat (limited to '')
-rw-r--r-- | src/tools/clippy/src/docs/diverging_sub_expression.txt | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/diverging_sub_expression.txt b/src/tools/clippy/src/docs/diverging_sub_expression.txt new file mode 100644 index 000000000..194362218 --- /dev/null +++ b/src/tools/clippy/src/docs/diverging_sub_expression.txt @@ -0,0 +1,19 @@ +### What it does +Checks for diverging calls that are not match arms or +statements. + +### Why is this bad? +It is often confusing to read. In addition, the +sub-expression evaluation order for Rust is not well documented. + +### Known problems +Someone might want to use `some_bool || panic!()` as a +shorthand. + +### Example +``` +let a = b() || panic!() || c(); +// `c()` is dead, `panic!()` is only called if `b()` returns `false` +let x = (a, b, c, panic!()); +// can simply be replaced by `panic!()` +```
\ No newline at end of file |