about summary refs log tree commit diff
path: root/src/docs/diverging_sub_expression.txt
diff options
context:
space:
mode:
authorPhilipp Krones <hello@philkrones.com>2022-09-09 13:36:26 +0200
committerPhilipp Krones <hello@philkrones.com>2022-09-09 13:36:26 +0200
commit98bf99e2f8cf8b357d63a67ce67d5fc5ceef8b3c (patch)
tree9737ff22b257f29282e7538d9ecb264451a3c1c0 /src/docs/diverging_sub_expression.txt
parent854f751b263dfac06dc3f635f8a9f92b8bc51da6 (diff)
Merge commit 'b52fb5234cd7c11ecfae51897a6f7fa52e8777fc' into clippyup
Diffstat (limited to 'src/docs/diverging_sub_expression.txt')
-rw-r--r--src/docs/diverging_sub_expression.txt19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/docs/diverging_sub_expression.txt b/src/docs/diverging_sub_expression.txt
new file mode 100644
index 00000000000..19436221802
--- /dev/null
+++ b/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