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.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/src/lints/bool_comparison.rs b/lib/src/lints/bool_comparison.rs
index ef7f5d2..5402f31 100644
--- a/lib/src/lints/bool_comparison.rs
+++ b/lib/src/lints/bool_comparison.rs
@@ -41,8 +41,9 @@ impl Rule for BoolComparison {
41 if let Some(bin_expr) = BinOp::cast(node.clone()); 41 if let Some(bin_expr) = BinOp::cast(node.clone());
42 if let Some(lhs) = bin_expr.lhs(); 42 if let Some(lhs) = bin_expr.lhs();
43 if let Some(rhs) = bin_expr.rhs(); 43 if let Some(rhs) = bin_expr.rhs();
44 if let Some(op) = bin_expr.operator();
44 45
45 if let op@(BinOpKind::Equal | BinOpKind::NotEqual) = bin_expr.operator(); 46 if let BinOpKind::Equal | BinOpKind::NotEqual = op;
46 let (non_bool_side, bool_side) = if boolean_ident(&lhs).is_some() { 47 let (non_bool_side, bool_side) = if boolean_ident(&lhs).is_some() {
47 (rhs, lhs) 48 (rhs, lhs)
48 } else if boolean_ident(&rhs).is_some() { 49 } else if boolean_ident(&rhs).is_some() {
@@ -70,7 +71,7 @@ impl Rule for BoolComparison {
70 SyntaxKind::NODE_BIN_OP => { 71 SyntaxKind::NODE_BIN_OP => {
71 let inner = BinOp::cast(non_bool_side.clone()).unwrap(); 72 let inner = BinOp::cast(non_bool_side.clone()).unwrap();
72 // `!a ? b`, no paren required 73 // `!a ? b`, no paren required
73 if inner.operator() == BinOpKind::IsSet { 74 if inner.operator()? == BinOpKind::IsSet {
74 make::unary_not(&non_bool_side).node().clone() 75 make::unary_not(&non_bool_side).node().clone()
75 } else { 76 } else {
76 let parens = make::parenthesize(&non_bool_side); 77 let parens = make::parenthesize(&non_bool_side);