fallout and tests
This commit is contained in:
parent
5911ccaba8
commit
050d7fd308
5 changed files with 32 additions and 6 deletions
|
|
@ -2,17 +2,17 @@ use rustc::lint::*;
|
|||
use rustc_front::hir::*;
|
||||
use rustc_front::intravisit::*;
|
||||
use syntax::ast::LitKind;
|
||||
use utils::{span_lint_and_then, in_macro, snippet_opt};
|
||||
use utils::{span_lint_and_then, in_macro, snippet_opt, SpanlessEq};
|
||||
|
||||
/// **What it does:** This lint checks for boolean expressions that can be written more concisely
|
||||
///
|
||||
/// **Why is this bad?** Readability of boolean expressions suffers from unnecesessary duplication
|
||||
///
|
||||
/// **Known problems:** None
|
||||
/// **Known problems:** Ignores short circuting behavior, bitwise and/or and xor. Ends up suggesting things like !(a == b)
|
||||
///
|
||||
/// **Example:** `if a && b || a` should be `if a`
|
||||
declare_lint! {
|
||||
pub NONMINIMAL_BOOL, Warn,
|
||||
pub NONMINIMAL_BOOL, Allow,
|
||||
"checks for boolean expressions that can be written more concisely"
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ fn levenstein_not_1(a_name: &str, b_name: &str) -> bool {
|
|||
}
|
||||
if let Some(b2) = b_chars.next() {
|
||||
// check if there's just one character inserted
|
||||
return !(a == b2 && a_chars.eq(b_chars));
|
||||
return a != b2 || a_chars.ne(b_chars);
|
||||
} else {
|
||||
// tuple
|
||||
// ntuple
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue