aboutsummaryrefslogtreecommitdiff
path: root/lib/src/lints/bool_comparison.rs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/src/lints/bool_comparison.rs')
-rw-r--r--lib/src/lints/bool_comparison.rs27
1 files changed, 12 insertions, 15 deletions
diff --git a/lib/src/lints/bool_comparison.rs b/lib/src/lints/bool_comparison.rs
index 6636faf..5c9bee8 100644
--- a/lib/src/lints/bool_comparison.rs
+++ b/lib/src/lints/bool_comparison.rs
@@ -7,28 +7,25 @@ use rnix::{
7 NodeOrToken, SyntaxElement, SyntaxKind, SyntaxNode, 7 NodeOrToken, SyntaxElement, SyntaxKind, SyntaxNode,
8}; 8};
9 9
10/// What it does 10/// ## What it does
11/// ------------ 11/// Checks for expressions of the form `x == true`, `x != true` and
12/// Checks for expressions of the form x == true, x != true and
13/// suggests using the variable directly. 12/// suggests using the variable directly.
14/// 13///
15/// Why is this bad? 14/// ## Why is this bad?
16/// ----------------
17/// Unnecessary code. 15/// Unnecessary code.
18/// 16///
19/// Example 17/// ## Example
20/// -------- 18/// Instead of checking the value of `x`:
21/// Instead of checking the value of x:
22/// 19///
23/// if x == true 20/// ```
24/// then 0 21/// if x == true then 0 else 1
25/// else 1 22/// ```
26/// 23///
27/// Use x directly: 24/// Use `x` directly:
28/// 25///
29/// if x 26/// ```
30/// then 0 27/// if x then 0 else 1
31/// else 1 28/// ```
32#[lint( 29#[lint(
33 name = "bool_comparison", 30 name = "bool_comparison",
34 note = "Unnecessary comparison with boolean", 31 note = "Unnecessary comparison with boolean",