You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/needless_bool.rs
+29-17Lines changed: 29 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ use rustc_front::hir::*;
8
8
use syntax::ast::Lit_;
9
9
use syntax::codemap::Spanned;
10
10
11
-
use utils::{span_lint, snippet};
11
+
use utils::{span_lint,span_lint_and_then,snippet};
12
12
13
13
/// **What it does:** This lint checks for expressions of the form `if c { true } else { false }` (or vice versa) and suggest using the condition directly.
14
14
///
@@ -109,34 +109,46 @@ impl LateLintPass for BoolComparison {
109
109
(Some(true),None) => {
110
110
let side_snip = snippet(cx, right_side.span,"..");
111
111
let hint = format!("`{}`", side_snip);
112
-
span_lint(cx,
113
-
BOOL_COMPARISON,
114
-
e.span,
115
-
&format!("you can simplify this boolean comparison to {}", hint));
112
+
span_lint_and_then(cx,
113
+
BOOL_COMPARISON,
114
+
e.span,
115
+
"equality checks against booleans are unnecesary",
0 commit comments