aboutsummaryrefslogtreecommitdiff
path: root/lib/src/lints
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-09-15 11:49:43 +0100
committerAkshay <[email protected]>2021-09-15 11:49:43 +0100
commit2ee7db0b3b6df787c7e62d3614f97a0e45d12a12 (patch)
tree04e3aad2b98f8c55ca88d6b409cd74263410f2cc /lib/src/lints
parent4152367f5dee2a70ff49f4aff4040d5d433b8e44 (diff)
implement lint_map
Diffstat (limited to 'lib/src/lints')
-rw-r--r--lib/src/lints/bool_comparison.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/src/lints/bool_comparison.rs b/lib/src/lints/bool_comparison.rs
index 4476b31..918126f 100644
--- a/lib/src/lints/bool_comparison.rs
+++ b/lib/src/lints/bool_comparison.rs
@@ -1,4 +1,4 @@
1use crate::{Diagnostic, Lint, Metadata, Rule}; 1use crate::{Lint, Metadata, Report, Rule};
2 2
3use if_chain::if_chain; 3use if_chain::if_chain;
4use macros::lint; 4use macros::lint;
@@ -10,12 +10,12 @@ use rnix::{
10#[lint( 10#[lint(
11 name = "bool_comparison", 11 name = "bool_comparison",
12 note = "Unnecessary comparison with boolean", 12 note = "Unnecessary comparison with boolean",
13 match_with = "SyntaxKind::NODE_BIN_OP" 13 match_with = SyntaxKind::NODE_BIN_OP
14)] 14)]
15struct BoolComparison; 15struct BoolComparison;
16 16
17impl Rule for BoolComparison { 17impl Rule for BoolComparison {
18 fn validate(&self, node: &SyntaxElement) -> Option<Diagnostic> { 18 fn validate(&self, node: &SyntaxElement) -> Option<Report> {
19 if_chain! { 19 if_chain! {
20 if let NodeOrToken::Node(bin_op_node) = node; 20 if let NodeOrToken::Node(bin_op_node) = node;
21 if let Some(bin_expr) = BinOp::cast(bin_op_node.clone()); 21 if let Some(bin_expr) = BinOp::cast(bin_op_node.clone());
@@ -37,7 +37,7 @@ impl Rule for BoolComparison {
37 non_bool_side, 37 non_bool_side,
38 bool_side 38 bool_side
39 ); 39 );
40 dbg!(Some(Diagnostic::new(at, message))) 40 Some(Report::new().diagnostic(at, message))
41 } else { 41 } else {
42 None 42 None
43 } 43 }