-use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
-use rustc::{declare_lint, lint_array};
-use rustc::hir::*;
-use rustc::hir::intravisit::*;
-use syntax::ast::{LitKind, NodeId, DUMMY_NODE_ID};
-use syntax::codemap::{dummy_spanned, Span, DUMMY_SP};
-use rustc_data_structures::thin_vec::ThinVec;
+use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
+use crate::rustc::{declare_tool_lint, lint_array};
+use crate::rustc::hir::*;
+use crate::rustc::hir::intravisit::*;
+use crate::syntax::ast::{LitKind, NodeId, DUMMY_NODE_ID};
+use crate::syntax::source_map::{dummy_spanned, Span, DUMMY_SP};
+use crate::rustc_data_structures::thin_vec::ThinVec;
use crate::utils::{in_macro, paths, match_type, snippet_opt, span_lint_and_then, SpanlessEq, get_trait_def_id, implements_trait};
+use crate::rustc_errors::Applicability;
/// **What it does:** Checks for boolean expressions that can be written more
/// concisely.
}
for (n, expr) in self.terminals.iter().enumerate() {
if SpanlessEq::new(self.cx).ignore_fn().eq_expr(e, expr) {
- #[allow(cast_possible_truncation)]
+ #[allow(clippy::cast_possible_truncation)]
return Ok(Bool::Term(n as u8));
}
let negated = match e.node {
_ => continue,
};
if SpanlessEq::new(self.cx).ignore_fn().eq_expr(&negated, expr) {
- #[allow(cast_possible_truncation)]
+ #[allow(clippy::cast_possible_truncation)]
return Ok(Bool::Not(Box::new(Bool::Term(n as u8))));
}
}
let n = self.terminals.len();
self.terminals.push(e);
if n < 32 {
- #[allow(cast_possible_truncation)]
+ #[allow(clippy::cast_possible_truncation)]
Ok(Bool::Term(n as u8))
} else {
Err("too many literals".to_owned())
"this expression can be optimized out by applying boolean operations to the \
outer expression",
);
- db.span_suggestion(
+ db.span_suggestion_with_applicability(
e.span,
"it would look like the following",
suggest(self.cx, suggestion, &h2q.terminals).0,
+ Applicability::Unspecified,
);
},
);