summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/needless_bitwise_bool.txt
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/tools/clippy/src/docs/needless_bitwise_bool.txt22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/needless_bitwise_bool.txt b/src/tools/clippy/src/docs/needless_bitwise_bool.txt
new file mode 100644
index 000000000..fcd7b730a
--- /dev/null
+++ b/src/tools/clippy/src/docs/needless_bitwise_bool.txt
@@ -0,0 +1,22 @@
+### What it does
+Checks for uses of bitwise and/or operators between booleans, where performance may be improved by using
+a lazy and.
+
+### Why is this bad?
+The bitwise operators do not support short-circuiting, so it may hinder code performance.
+Additionally, boolean logic "masked" as bitwise logic is not caught by lints like `unnecessary_fold`
+
+### Known problems
+This lint evaluates only when the right side is determined to have no side effects. At this time, that
+determination is quite conservative.
+
+### Example
+```
+let (x,y) = (true, false);
+if x & !y {} // where both x and y are booleans
+```
+Use instead:
+```
+let (x,y) = (true, false);
+if x && !y {}
+``` \ No newline at end of file