1
Fork 0

update to the rust-PR that unblocks clippy

This commit is contained in:
Oliver Schneider 2016-12-07 13:13:40 +01:00
parent 4a05fbba3e
commit 778ce4dfd3
No known key found for this signature in database
GPG key ID: 56D6EEA0FC67AC46
66 changed files with 217 additions and 217 deletions

View file

@ -59,8 +59,8 @@ impl LintPass for Pass {
} }
} }
impl LateLintPass for Pass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
if let ExprLit(ref lit) = e.node { if let ExprLit(ref lit) = e.node {
check_lit(cx, lit, e); check_lit(cx, lit, e);
} }

View file

@ -47,8 +47,8 @@ impl LintPass for Arithmetic {
} }
} }
impl LateLintPass for Arithmetic { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Arithmetic {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr) {
if self.span.is_some() { if self.span.is_some() {
return; return;
} }
@ -82,7 +82,7 @@ impl LateLintPass for Arithmetic {
} }
} }
fn check_expr_post<'a, 'tcx: 'a>(&mut self, _: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr) { fn check_expr_post(&mut self, _: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr) {
if Some(expr.span) == self.span { if Some(expr.span) == self.span {
self.span = None; self.span = None;
} }

View file

@ -55,8 +55,8 @@ impl LintPass for ArrayIndexing {
} }
} }
impl LateLintPass for ArrayIndexing { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ArrayIndexing {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx hir::Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx hir::Expr) {
if let hir::ExprIndex(ref array, ref index) = e.node { if let hir::ExprIndex(ref array, ref index) = e.node {
// Array with known size can be checked statically // Array with known size can be checked statically
let ty = cx.tcx.tables().expr_ty(array); let ty = cx.tcx.tables().expr_ty(array);

View file

@ -66,8 +66,8 @@ impl LintPass for AssignOps {
} }
} }
impl LateLintPass for AssignOps { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr) {
match expr.node { match expr.node {
hir::ExprAssignOp(op, ref lhs, ref rhs) => { hir::ExprAssignOp(op, ref lhs, ref rhs) => {
span_lint_and_then(cx, ASSIGN_OPS, expr.span, "assign operation detected", |db| { span_lint_and_then(cx, ASSIGN_OPS, expr.span, "assign operation detected", |db| {

View file

@ -81,8 +81,8 @@ impl LintPass for AttrPass {
} }
} }
impl LateLintPass for AttrPass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass {
fn check_attribute<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, attr: &'tcx Attribute) { fn check_attribute(&mut self, cx: &LateContext<'a, 'tcx>, attr: &'tcx Attribute) {
if let MetaItemKind::List(ref items) = attr.value.node { if let MetaItemKind::List(ref items) = attr.value.node {
if items.is_empty() || attr.name() != "deprecated" { if items.is_empty() || attr.name() != "deprecated" {
return; return;
@ -99,7 +99,7 @@ impl LateLintPass for AttrPass {
} }
} }
fn check_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
if is_relevant_item(cx, item) { if is_relevant_item(cx, item) {
check_attrs(cx, item.span, &item.name, &item.attrs) check_attrs(cx, item.span, &item.name, &item.attrs)
} }
@ -138,13 +138,13 @@ impl LateLintPass for AttrPass {
} }
} }
fn check_impl_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx ImplItem) { fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx ImplItem) {
if is_relevant_impl(cx, item) { if is_relevant_impl(cx, item) {
check_attrs(cx, item.span, &item.name, &item.attrs) check_attrs(cx, item.span, &item.name, &item.attrs)
} }
} }
fn check_trait_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx TraitItem) { fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx TraitItem) {
if is_relevant_trait(cx, item) { if is_relevant_trait(cx, item) {
check_attrs(cx, item.span, &item.name, &item.attrs) check_attrs(cx, item.span, &item.name, &item.attrs)
} }

View file

@ -79,8 +79,8 @@ impl LintPass for BitMask {
} }
} }
impl LateLintPass for BitMask { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BitMask {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
if let ExprBinary(ref cmp, ref left, ref right) = e.node { if let ExprBinary(ref cmp, ref left, ref right) = e.node {
if cmp.node.is_comparison() { if cmp.node.is_comparison() {
if let Some(cmp_opt) = fetch_int_literal(cx, right) { if let Some(cmp_opt) = fetch_int_literal(cx, right) {

View file

@ -37,8 +37,8 @@ impl LintPass for BlackListedName {
} }
} }
impl LateLintPass for BlackListedName { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BlackListedName {
fn check_pat<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, pat: &'tcx Pat) { fn check_pat(&mut self, cx: &LateContext<'a, 'tcx>, pat: &'tcx Pat) {
if let PatKind::Binding(_, _, ref ident, _) = pat.node { if let PatKind::Binding(_, _, ref ident, _) = pat.node {
if self.blacklist.iter().any(|s| s == &*ident.node.as_str()) { if self.blacklist.iter().any(|s| s == &*ident.node.as_str()) {
span_lint(cx, span_lint(cx,

View file

@ -74,8 +74,8 @@ const BRACED_EXPR_MESSAGE: &'static str = "omit braces around single expression
const COMPLEX_BLOCK_MESSAGE: &'static str = "in an 'if' condition, avoid complex blocks or closures with blocks; \ const COMPLEX_BLOCK_MESSAGE: &'static str = "in an 'if' condition, avoid complex blocks or closures with blocks; \
instead, move the block or closure higher and bind it with a 'let'"; instead, move the block or closure higher and bind it with a 'let'";
impl LateLintPass for BlockInIfCondition { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BlockInIfCondition {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
if let ExprIf(ref check, ref then, _) = expr.node { if let ExprIf(ref check, ref then, _) = expr.node {
if let ExprBlock(ref block) = check.node { if let ExprBlock(ref block) = check.node {
if block.rules == DefaultBlock { if block.rules == DefaultBlock {

View file

@ -53,8 +53,8 @@ impl LintPass for NonminimalBool {
} }
} }
impl LateLintPass for NonminimalBool { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonminimalBool {
fn check_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
NonminimalBoolVisitor { cx: cx }.visit_item(item) NonminimalBoolVisitor { cx: cx }.visit_item(item)
} }
} }

View file

@ -109,8 +109,8 @@ impl LintPass for CopyAndPaste {
} }
} }
impl LateLintPass for CopyAndPaste { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CopyAndPaste {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
if !in_macro(cx, expr.span) { if !in_macro(cx, expr.span) {
// skip ifs directly in else, it will be checked in the parent if // skip ifs directly in else, it will be checked in the parent if
if let Some(&Expr { node: ExprIf(_, _, Some(ref else_expr)), .. }) = get_parent_expr(cx, expr) { if let Some(&Expr { node: ExprIf(_, _, Some(ref else_expr)), .. }) = get_parent_expr(cx, expr) {

View file

@ -90,8 +90,8 @@ impl CyclomaticComplexity {
} }
} }
impl LateLintPass for CyclomaticComplexity { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CyclomaticComplexity {
fn check_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
if let ItemFn(_, _, _, _, _, eid) = item.node { if let ItemFn(_, _, _, _, _, eid) = item.node {
if !attr::contains_name(&item.attrs, "test") { if !attr::contains_name(&item.attrs, "test") {
self.check(cx, cx.tcx.map.expr(eid), item.span); self.check(cx, cx.tcx.map.expr(eid), item.span);
@ -99,22 +99,22 @@ impl LateLintPass for CyclomaticComplexity {
} }
} }
fn check_impl_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx ImplItem) { fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx ImplItem) {
if let ImplItemKind::Method(_, eid) = item.node { if let ImplItemKind::Method(_, eid) = item.node {
self.check(cx, cx.tcx.map.expr(eid), item.span); self.check(cx, cx.tcx.map.expr(eid), item.span);
} }
} }
fn check_trait_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx TraitItem) { fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx TraitItem) {
if let MethodTraitItem(_, Some(eid)) = item.node { if let MethodTraitItem(_, Some(eid)) = item.node {
self.check(cx, cx.tcx.map.expr(eid), item.span); self.check(cx, cx.tcx.map.expr(eid), item.span);
} }
} }
fn enter_lint_attrs<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, attrs: &'tcx [Attribute]) { fn enter_lint_attrs(&mut self, cx: &LateContext<'a, 'tcx>, attrs: &'tcx [Attribute]) {
self.limit.push_attrs(cx.sess(), attrs, "cyclomatic_complexity"); self.limit.push_attrs(cx.sess(), attrs, "cyclomatic_complexity");
} }
fn exit_lint_attrs<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, attrs: &'tcx [Attribute]) { fn exit_lint_attrs(&mut self, cx: &LateContext<'a, 'tcx>, attrs: &'tcx [Attribute]) {
self.limit.pop_attrs(cx.sess(), attrs, "cyclomatic_complexity"); self.limit.pop_attrs(cx.sess(), attrs, "cyclomatic_complexity");
} }
} }

View file

@ -70,8 +70,8 @@ impl LintPass for Derive {
} }
} }
impl LateLintPass for Derive { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Derive {
fn check_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
if let ItemImpl(_, _, _, Some(ref trait_ref), _, _) = item.node { if let ItemImpl(_, _, _, Some(ref trait_ref), _, _) = item.node {
let ty = cx.tcx.item_type(cx.tcx.map.local_def_id(item.id)); let ty = cx.tcx.item_type(cx.tcx.map.local_def_id(item.id));
let is_automatically_derived = is_automatically_derived(&*item.attrs); let is_automatically_derived = is_automatically_derived(&*item.attrs);
@ -86,7 +86,7 @@ impl LateLintPass for Derive {
} }
/// Implementation of the `DERIVE_HASH_XOR_EQ` lint. /// Implementation of the `DERIVE_HASH_XOR_EQ` lint.
fn check_hash_peq<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, span: Span, trait_ref: &TraitRef, ty: ty::Ty<'tcx>, fn check_hash_peq<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, span: Span, trait_ref: &TraitRef, ty: ty::Ty<'tcx>,
hash_is_automatically_derived: bool) { hash_is_automatically_derived: bool) {
if_let_chain! {[ if_let_chain! {[
match_path_old(&trait_ref.path, &paths::HASH), match_path_old(&trait_ref.path, &paths::HASH),

View file

@ -35,8 +35,8 @@ impl LintPass for Pass {
} }
} }
impl LateLintPass for Pass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
if let ExprCall(ref path, ref args) = expr.node { if let ExprCall(ref path, ref args) = expr.node {
if let ExprPath(ref qpath) = path.node { if let ExprPath(ref qpath) = path.node {
let def_id = cx.tcx.tables().qpath_def(qpath, path.id).def_id(); let def_id = cx.tcx.tables().qpath_def(qpath, path.id).def_id();

View file

@ -39,8 +39,8 @@ impl LintPass for HashMapLint {
} }
} }
impl LateLintPass for HashMapLint { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for HashMapLint {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
if let ExprIf(ref check, ref then_block, ref else_block) = expr.node { if let ExprIf(ref check, ref then_block, ref else_block) = expr.node {
if let ExprUnary(UnOp::UnNot, ref check) = check.node { if let ExprUnary(UnOp::UnNot, ref check) = check.node {
if let Some((ty, map, key)) = check_cond(cx, check) { if let Some((ty, map, key)) = check_cond(cx, check) {

View file

@ -36,9 +36,9 @@ impl LintPass for UnportableVariant {
} }
} }
impl LateLintPass for UnportableVariant { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnportableVariant {
#[allow(cast_possible_truncation, cast_sign_loss)] #[allow(cast_possible_truncation, cast_sign_loss)]
fn check_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
if let ItemEnum(ref def, _) = item.node { if let ItemEnum(ref def, _) = item.node {
for var in &def.variants { for var in &def.variants {
let variant = &var.node; let variant = &var.node;

View file

@ -32,8 +32,8 @@ impl LintPass for EnumGlobUse {
} }
} }
impl LateLintPass for EnumGlobUse { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EnumGlobUse {
fn check_mod<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, m: &'tcx Mod, _: Span, _: NodeId) { fn check_mod(&mut self, cx: &LateContext<'a, 'tcx>, m: &'tcx Mod, _: Span, _: NodeId) {
// only check top level `use` statements // only check top level `use` statements
for item in &m.item_ids { for item in &m.item_ids {
self.lint_item(cx, cx.krate.item(item.id)); self.lint_item(cx, cx.krate.item(item.id));

View file

@ -32,8 +32,8 @@ impl LintPass for EqOp {
} }
} }
impl LateLintPass for EqOp { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
if let ExprBinary(ref op, ref left, ref right) = e.node { if let ExprBinary(ref op, ref left, ref right) = e.node {
if is_valid_operator(op) && SpanlessEq::new(cx).ignore_fn().eq_expr(left, right) { if is_valid_operator(op) && SpanlessEq::new(cx).ignore_fn().eq_expr(left, right) {
span_lint(cx, span_lint(cx,

View file

@ -60,8 +60,8 @@ impl LintPass for Pass {
} }
} }
impl LateLintPass for Pass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
fn check_fn<'a, 'tcx: 'a>( fn check_fn(
&mut self, &mut self,
cx: &LateContext<'a, 'tcx>, cx: &LateContext<'a, 'tcx>,
_: visit::FnKind<'tcx>, _: visit::FnKind<'tcx>,

View file

@ -33,8 +33,8 @@ impl LintPass for EtaPass {
} }
} }
impl LateLintPass for EtaPass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EtaPass {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
match expr.node { match expr.node {
ExprCall(_, ref args) | ExprCall(_, ref args) |
ExprMethodCall(_, _, ref args) => { ExprMethodCall(_, _, ref args) => {

View file

@ -56,8 +56,8 @@ impl LintPass for EvalOrderDependence {
} }
} }
impl LateLintPass for EvalOrderDependence { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EvalOrderDependence {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
// Find a write to a local variable. // Find a write to a local variable.
match expr.node { match expr.node {
ExprAssign(ref lhs, _) | ExprAssignOp(_, ref lhs, _) => { ExprAssign(ref lhs, _) | ExprAssignOp(_, ref lhs, _) => {
@ -79,7 +79,7 @@ impl LateLintPass for EvalOrderDependence {
_ => {} _ => {}
} }
} }
fn check_stmt<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, stmt: &'tcx Stmt) { fn check_stmt(&mut self, cx: &LateContext<'a, 'tcx>, stmt: &'tcx Stmt) {
match stmt.node { match stmt.node {
StmtExpr(ref e, _) | StmtSemi(ref e, _) => DivergenceVisitor { cx: cx }.maybe_walk_expr(e), StmtExpr(ref e, _) | StmtSemi(ref e, _) => DivergenceVisitor { cx: cx }.maybe_walk_expr(e),
StmtDecl(ref d, _) => { StmtDecl(ref d, _) => {
@ -214,7 +214,7 @@ enum StopEarly {
Stop, Stop,
} }
fn check_expr<'a, 'tcx: 'a>(vis: & mut ReadVisitor<'a, 'tcx>, expr: &'tcx Expr) -> StopEarly { fn check_expr<'a, 'tcx>(vis: & mut ReadVisitor<'a, 'tcx>, expr: &'tcx Expr) -> StopEarly {
if expr.id == vis.last_expr.id { if expr.id == vis.last_expr.id {
return StopEarly::KeepGoing; return StopEarly::KeepGoing;
} }
@ -263,7 +263,7 @@ fn check_expr<'a, 'tcx: 'a>(vis: & mut ReadVisitor<'a, 'tcx>, expr: &'tcx Expr)
StopEarly::KeepGoing StopEarly::KeepGoing
} }
fn check_stmt<'a, 'tcx: 'a>(vis: &mut ReadVisitor<'a, 'tcx>, stmt: &'tcx Stmt) -> StopEarly { fn check_stmt<'a, 'tcx>(vis: &mut ReadVisitor<'a, 'tcx>, stmt: &'tcx Stmt) -> StopEarly {
match stmt.node { match stmt.node {
StmtExpr(ref expr, _) | StmtExpr(ref expr, _) |
StmtSemi(ref expr, _) => check_expr(vis, expr), StmtSemi(ref expr, _) => check_expr(vis, expr),

View file

@ -38,8 +38,8 @@ impl LintPass for Pass {
} }
} }
impl LateLintPass for Pass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
if let Some(span) = is_expn_of(cx, expr.span, "format") { if let Some(span) = is_expn_of(cx, expr.span, "format") {
match expr.node { match expr.node {
// `format!("{}", foo)` expansion // `format!("{}", foo)` expansion

View file

@ -68,8 +68,8 @@ impl LintPass for Functions {
} }
} }
impl LateLintPass for Functions { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions {
fn check_fn<'a, 'tcx: 'a>( fn check_fn(
&mut self, &mut self,
cx: &LateContext<'a, 'tcx>, cx: &LateContext<'a, 'tcx>,
kind: intravisit::FnKind<'tcx>, kind: intravisit::FnKind<'tcx>,
@ -105,7 +105,7 @@ impl LateLintPass for Functions {
self.check_raw_ptr(cx, unsafety, decl, expr, nodeid); self.check_raw_ptr(cx, unsafety, decl, expr, nodeid);
} }
fn check_trait_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::TraitItem) { fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::TraitItem) {
if let hir::MethodTraitItem(ref sig, eid) = item.node { if let hir::MethodTraitItem(ref sig, eid) = item.node {
// don't lint extern functions decls, it's not their fault // don't lint extern functions decls, it's not their fault
if sig.abi == Abi::Rust { if sig.abi == Abi::Rust {
@ -120,7 +120,7 @@ impl LateLintPass for Functions {
} }
} }
impl Functions { impl<'a, 'tcx> Functions {
fn check_arg_number(&self, cx: &LateContext, decl: &hir::FnDecl, span: Span) { fn check_arg_number(&self, cx: &LateContext, decl: &hir::FnDecl, span: Span) {
let args = decl.inputs.len() as u64; let args = decl.inputs.len() as u64;
if args > self.threshold { if args > self.threshold {
@ -131,7 +131,7 @@ impl Functions {
} }
} }
fn check_raw_ptr<'a, 'tcx: 'a>( fn check_raw_ptr(
&self, &self,
cx: &LateContext<'a, 'tcx>, cx: &LateContext<'a, 'tcx>,
unsafety: hir::Unsafety, unsafety: hir::Unsafety,

View file

@ -31,8 +31,8 @@ impl LintPass for IdentityOp {
} }
} }
impl LateLintPass for IdentityOp { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for IdentityOp {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
if in_macro(cx, e.span) { if in_macro(cx, e.span) {
return; return;
} }

View file

@ -42,8 +42,8 @@ impl LintPass for Pass {
} }
} }
impl LateLintPass for Pass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
if let ExprMatch(ref op, ref arms, MatchSource::IfLetDesugar{..}) = expr.node { if let ExprMatch(ref op, ref arms, MatchSource::IfLetDesugar{..}) = expr.node {

View file

@ -59,8 +59,8 @@ impl LintPass for LenZero {
} }
} }
impl LateLintPass for LenZero { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LenZero {
fn check_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
if in_macro(cx, item.span) { if in_macro(cx, item.span) {
return; return;
} }
@ -72,7 +72,7 @@ impl LateLintPass for LenZero {
} }
} }
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
if in_macro(cx, expr.span) { if in_macro(cx, expr.span) {
return; return;
} }

View file

@ -57,8 +57,8 @@ impl LintPass for LetIfSeq {
} }
} }
impl LateLintPass for LetIfSeq { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LetIfSeq {
fn check_block<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, block: &'tcx hir::Block) { fn check_block(&mut self, cx: &LateContext<'a, 'tcx>, block: &'tcx hir::Block) {
let mut it = block.stmts.iter().peekable(); let mut it = block.stmts.iter().peekable();
while let Some(stmt) = it.next() { while let Some(stmt) = it.next() {
if_let_chain! {[ if_let_chain! {[
@ -149,7 +149,7 @@ impl<'a, 'tcx> hir::intravisit::Visitor<'tcx> for UsedVisitor<'a, 'tcx> {
} }
} }
fn check_assign<'a, 'tcx: 'a>( fn check_assign<'a, 'tcx>(
cx: &LateContext<'a, 'tcx>, cx: &LateContext<'a, 'tcx>,
decl: hir::def_id::DefId, decl: hir::def_id::DefId,
block: &'tcx hir::Block, block: &'tcx hir::Block,

View file

@ -56,20 +56,20 @@ impl LintPass for LifetimePass {
} }
} }
impl LateLintPass for LifetimePass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LifetimePass {
fn check_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
if let ItemFn(ref decl, _, _, _, ref generics, _) = item.node { if let ItemFn(ref decl, _, _, _, ref generics, _) = item.node {
check_fn_inner(cx, decl, generics, item.span); check_fn_inner(cx, decl, generics, item.span);
} }
} }
fn check_impl_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx ImplItem) { fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx ImplItem) {
if let ImplItemKind::Method(ref sig, _) = item.node { if let ImplItemKind::Method(ref sig, _) = item.node {
check_fn_inner(cx, &sig.decl, &sig.generics, item.span); check_fn_inner(cx, &sig.decl, &sig.generics, item.span);
} }
} }
fn check_trait_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx TraitItem) { fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx TraitItem) {
if let MethodTraitItem(ref sig, _) = item.node { if let MethodTraitItem(ref sig, _) = item.node {
check_fn_inner(cx, &sig.decl, &sig.generics, item.span); check_fn_inner(cx, &sig.decl, &sig.generics, item.span);
} }
@ -98,7 +98,7 @@ fn bound_lifetimes(bound: &TyParamBound) -> HirVec<&Lifetime> {
} }
} }
fn check_fn_inner<'a, 'tcx: 'a>( fn check_fn_inner<'a, 'tcx>(
cx: &LateContext<'a, 'tcx>, cx: &LateContext<'a, 'tcx>,
decl: &'tcx FnDecl, decl: &'tcx FnDecl,
generics: &'tcx Generics, generics: &'tcx Generics,

View file

@ -307,8 +307,8 @@ impl LintPass for Pass {
} }
} }
impl LateLintPass for Pass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
if let Some((pat, arg, body)) = higher::for_loop(expr) { if let Some((pat, arg, body)) = higher::for_loop(expr) {
check_for_loop(cx, pat, arg, body, expr); check_for_loop(cx, pat, arg, body, expr);
} }
@ -391,7 +391,7 @@ impl LateLintPass for Pass {
} }
} }
fn check_stmt<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, stmt: &'tcx Stmt) { fn check_stmt(&mut self, cx: &LateContext<'a, 'tcx>, stmt: &'tcx Stmt) {
if let StmtSemi(ref expr, _) = stmt.node { if let StmtSemi(ref expr, _) = stmt.node {
if let ExprMethodCall(ref method, _, ref args) = expr.node { if let ExprMethodCall(ref method, _, ref args) = expr.node {
if args.len() == 1 && &*method.node.as_str() == "collect" && if args.len() == 1 && &*method.node.as_str() == "collect" &&
@ -407,7 +407,7 @@ impl LateLintPass for Pass {
} }
} }
fn check_for_loop<'a, 'tcx: 'a>( fn check_for_loop<'a, 'tcx>(
cx: &LateContext<'a, 'tcx>, cx: &LateContext<'a, 'tcx>,
pat: &'tcx Pat, pat: &'tcx Pat,
arg: &'tcx Expr, arg: &'tcx Expr,
@ -423,7 +423,7 @@ fn check_for_loop<'a, 'tcx: 'a>(
/// Check for looping over a range and then indexing a sequence with it. /// Check for looping over a range and then indexing a sequence with it.
/// The iteratee must be a range literal. /// The iteratee must be a range literal.
fn check_for_loop_range<'a, 'tcx: 'a>( fn check_for_loop_range<'a, 'tcx>(
cx: &LateContext<'a, 'tcx>, cx: &LateContext<'a, 'tcx>,
pat: &'tcx Pat, pat: &'tcx Pat,
arg: &'tcx Expr, arg: &'tcx Expr,
@ -658,7 +658,7 @@ fn check_arg_type(cx: &LateContext, pat: &Pat, arg: &Expr) {
} }
} }
fn check_for_loop_explicit_counter<'a, 'tcx: 'a>( fn check_for_loop_explicit_counter<'a, 'tcx>(
cx: &LateContext<'a, 'tcx>, cx: &LateContext<'a, 'tcx>,
arg: &'tcx Expr, arg: &'tcx Expr,
body: &'tcx Expr, body: &'tcx Expr,
@ -708,7 +708,7 @@ fn check_for_loop_explicit_counter<'a, 'tcx: 'a>(
} }
/// Check for the `FOR_KV_MAP` lint. /// Check for the `FOR_KV_MAP` lint.
fn check_for_loop_over_map_kv<'a, 'tcx: 'a>( fn check_for_loop_over_map_kv<'a, 'tcx>(
cx: &LateContext<'a, 'tcx>, cx: &LateContext<'a, 'tcx>,
pat: &'tcx Pat, pat: &'tcx Pat,
arg: &'tcx Expr, arg: &'tcx Expr,

View file

@ -24,8 +24,8 @@ declare_lint! {
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
pub struct Pass; pub struct Pass;
impl LateLintPass for Pass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
// call to .map() // call to .map()
if let ExprMethodCall(name, _, ref args) = expr.node { if let ExprMethodCall(name, _, ref args) = expr.node {
if &*name.node.as_str() == "map" && args.len() == 2 { if &*name.node.as_str() == "map" && args.len() == 2 {

View file

@ -129,8 +129,8 @@ impl LintPass for MatchPass {
} }
} }
impl LateLintPass for MatchPass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MatchPass {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
if in_external_macro(cx, expr.span) { if in_external_macro(cx, expr.span) {
return; return;
} }

View file

@ -27,8 +27,8 @@ impl LintPass for MemForget {
} }
} }
impl LateLintPass for MemForget { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MemForget {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
if let ExprCall(ref path_expr, ref args) = e.node { if let ExprCall(ref path_expr, ref args) = e.node {
if let ExprPath(ref qpath) = path_expr.node { if let ExprPath(ref qpath) = path_expr.node {
let def_id = cx.tcx.tables().qpath_def(qpath, path_expr.id).def_id(); let def_id = cx.tcx.tables().qpath_def(qpath, path_expr.id).def_id();

View file

@ -549,11 +549,11 @@ impl LintPass for Pass {
} }
} }
impl LateLintPass for Pass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
#[allow(unused_attributes)] #[allow(unused_attributes)]
// ^ required because `cyclomatic_complexity` attribute shows up as unused // ^ required because `cyclomatic_complexity` attribute shows up as unused
#[cyclomatic_complexity = "30"] #[cyclomatic_complexity = "30"]
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr) {
if in_macro(cx, expr.span) { if in_macro(cx, expr.span) {
return; return;
} }
@ -629,7 +629,7 @@ impl LateLintPass for Pass {
} }
} }
fn check_impl_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, implitem: &'tcx hir::ImplItem) { fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, implitem: &'tcx hir::ImplItem) {
if in_external_macro(cx, implitem.span) { if in_external_macro(cx, implitem.span) {
return; return;
} }

View file

@ -33,8 +33,8 @@ impl LintPass for MinMaxPass {
} }
} }
impl LateLintPass for MinMaxPass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MinMaxPass {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
if let Some((outer_max, outer_c, oe)) = min_max(cx, expr) { if let Some((outer_max, outer_c, oe)) = min_max(cx, expr) {
if let Some((inner_max, inner_c, _)) = min_max(cx, oe) { if let Some((inner_max, inner_c, _)) = min_max(cx, oe) {
if outer_max == inner_max { if outer_max == inner_max {

View file

@ -166,8 +166,8 @@ impl LintPass for Pass {
} }
} }
impl LateLintPass for Pass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
fn check_fn<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, k: FnKind<'tcx>, decl: &'tcx FnDecl, _: &'tcx Expr, _: Span, _: NodeId) { fn check_fn(&mut self, cx: &LateContext<'a, 'tcx>, k: FnKind<'tcx>, decl: &'tcx FnDecl, _: &'tcx Expr, _: Span, _: NodeId) {
if let FnKind::Closure(_) = k { if let FnKind::Closure(_) = k {
// Does not apply to closures // Does not apply to closures
return; return;
@ -182,7 +182,7 @@ impl LateLintPass for Pass {
} }
} }
fn check_stmt<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, s: &'tcx Stmt) { fn check_stmt(&mut self, cx: &LateContext<'a, 'tcx>, s: &'tcx Stmt) {
if_let_chain! {[ if_let_chain! {[
let StmtDecl(ref d, _) = s.node, let StmtDecl(ref d, _) = s.node,
let DeclLocal(ref l) = d.node, let DeclLocal(ref l) = d.node,
@ -216,7 +216,7 @@ impl LateLintPass for Pass {
}} }}
} }
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
if let ExprBinary(ref cmp, ref left, ref right) = expr.node { if let ExprBinary(ref cmp, ref left, ref right) = expr.node {
let op = cmp.node; let op = cmp.node;
if op.is_comparison() { if op.is_comparison() {
@ -294,7 +294,7 @@ impl LateLintPass for Pass {
} }
} }
fn check_pat<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, pat: &'tcx Pat) { fn check_pat(&mut self, cx: &LateContext<'a, 'tcx>, pat: &'tcx Pat) {
if let PatKind::Binding(_, _, ref ident, Some(ref right)) = pat.node { if let PatKind::Binding(_, _, ref ident, Some(ref right)) = pat.node {
if right.node == PatKind::Wild { if right.node == PatKind::Wild {
span_lint(cx, span_lint(cx,

View file

@ -94,8 +94,8 @@ impl LintPass for MissingDoc {
} }
} }
impl LateLintPass for MissingDoc { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
fn enter_lint_attrs<'a, 'tcx: 'a>(&mut self, _: &LateContext<'a, 'tcx>, attrs: &'tcx [ast::Attribute]) { fn enter_lint_attrs(&mut self, _: &LateContext<'a, 'tcx>, attrs: &'tcx [ast::Attribute]) {
let doc_hidden = self.doc_hidden() || attrs.iter().any(|attr| { let doc_hidden = self.doc_hidden() || attrs.iter().any(|attr| {
attr.check_name("doc") && match attr.meta_item_list() { attr.check_name("doc") && match attr.meta_item_list() {
None => false, None => false,
@ -105,15 +105,15 @@ impl LateLintPass for MissingDoc {
self.doc_hidden_stack.push(doc_hidden); self.doc_hidden_stack.push(doc_hidden);
} }
fn exit_lint_attrs<'a, 'tcx: 'a>(&mut self, _: &LateContext<'a, 'tcx>, _: &'tcx [ast::Attribute]) { fn exit_lint_attrs(&mut self, _: &LateContext<'a, 'tcx>, _: &'tcx [ast::Attribute]) {
self.doc_hidden_stack.pop().expect("empty doc_hidden_stack"); self.doc_hidden_stack.pop().expect("empty doc_hidden_stack");
} }
fn check_crate<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, krate: &'tcx hir::Crate) { fn check_crate(&mut self, cx: &LateContext<'a, 'tcx>, krate: &'tcx hir::Crate) {
self.check_missing_docs_attrs(cx, &krate.attrs, krate.span, "crate"); self.check_missing_docs_attrs(cx, &krate.attrs, krate.span, "crate");
} }
fn check_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, it: &'tcx hir::Item) { fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, it: &'tcx hir::Item) {
let desc = match it.node { let desc = match it.node {
hir::ItemConst(..) => "a constant", hir::ItemConst(..) => "a constant",
hir::ItemEnum(..) => "an enum", hir::ItemEnum(..) => "an enum",
@ -134,7 +134,7 @@ impl LateLintPass for MissingDoc {
self.check_missing_docs_attrs(cx, &it.attrs, it.span, desc); self.check_missing_docs_attrs(cx, &it.attrs, it.span, desc);
} }
fn check_trait_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, trait_item: &'tcx hir::TraitItem) { fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, trait_item: &'tcx hir::TraitItem) {
let desc = match trait_item.node { let desc = match trait_item.node {
hir::ConstTraitItem(..) => "an associated constant", hir::ConstTraitItem(..) => "an associated constant",
hir::MethodTraitItem(..) => "a trait method", hir::MethodTraitItem(..) => "a trait method",
@ -144,7 +144,7 @@ impl LateLintPass for MissingDoc {
self.check_missing_docs_attrs(cx, &trait_item.attrs, trait_item.span, desc); self.check_missing_docs_attrs(cx, &trait_item.attrs, trait_item.span, desc);
} }
fn check_impl_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, impl_item: &'tcx hir::ImplItem) { fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, impl_item: &'tcx hir::ImplItem) {
// If the method is an impl for a trait, don't doc. // If the method is an impl for a trait, don't doc.
let def_id = cx.tcx.map.local_def_id(impl_item.id); let def_id = cx.tcx.map.local_def_id(impl_item.id);
match cx.tcx.associated_item(def_id).container { match cx.tcx.associated_item(def_id).container {
@ -164,13 +164,13 @@ impl LateLintPass for MissingDoc {
self.check_missing_docs_attrs(cx, &impl_item.attrs, impl_item.span, desc); self.check_missing_docs_attrs(cx, &impl_item.attrs, impl_item.span, desc);
} }
fn check_struct_field<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, sf: &'tcx hir::StructField) { fn check_struct_field(&mut self, cx: &LateContext<'a, 'tcx>, sf: &'tcx hir::StructField) {
if !sf.is_positional() { if !sf.is_positional() {
self.check_missing_docs_attrs(cx, &sf.attrs, sf.span, "a struct field"); self.check_missing_docs_attrs(cx, &sf.attrs, sf.span, "a struct field");
} }
} }
fn check_variant<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, v: &'tcx hir::Variant, _: &hir::Generics) { fn check_variant(&mut self, cx: &LateContext<'a, 'tcx>, v: &'tcx hir::Variant, _: &hir::Generics) {
self.check_missing_docs_attrs(cx, &v.node.attrs, v.span, "a variant"); self.check_missing_docs_attrs(cx, &v.node.attrs, v.span, "a variant");
} }
} }

View file

@ -31,12 +31,12 @@ impl LintPass for MutMut {
} }
} }
impl LateLintPass for MutMut { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MutMut {
fn check_block<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, block: &'tcx hir::Block) { fn check_block(&mut self, cx: &LateContext<'a, 'tcx>, block: &'tcx hir::Block) {
intravisit::walk_block(&mut MutVisitor { cx: cx }, block); intravisit::walk_block(&mut MutVisitor { cx: cx }, block);
} }
fn check_ty<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, ty: &'tcx hir::Ty) { fn check_ty(&mut self, cx: &LateContext<'a, 'tcx>, ty: &'tcx hir::Ty) {
use rustc::hir::intravisit::Visitor; use rustc::hir::intravisit::Visitor;
MutVisitor { cx: cx }.visit_ty(ty); MutVisitor { cx: cx }.visit_ty(ty);

View file

@ -32,8 +32,8 @@ impl LintPass for UnnecessaryMutPassed {
} }
} }
impl LateLintPass for UnnecessaryMutPassed { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnnecessaryMutPassed {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
let borrowed_table = cx.tcx.tables.borrow(); let borrowed_table = cx.tcx.tables.borrow();
match e.node { match e.node {
ExprCall(ref fn_expr, ref arguments) => { ExprCall(ref fn_expr, ref arguments) => {

View file

@ -54,8 +54,8 @@ impl LintPass for MutexAtomic {
pub struct MutexAtomic; pub struct MutexAtomic;
impl LateLintPass for MutexAtomic { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MutexAtomic {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
let ty = cx.tcx.tables().expr_ty(expr); let ty = cx.tcx.tables().expr_ty(expr);
if let ty::TyAdt(_, subst) = ty.sty { if let ty::TyAdt(_, subst) = ty.sty {
if match_type(cx, ty, &paths::MUTEX) { if match_type(cx, ty, &paths::MUTEX) {

View file

@ -56,8 +56,8 @@ impl LintPass for NeedlessBool {
} }
} }
impl LateLintPass for NeedlessBool { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessBool {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
use self::Expression::*; use self::Expression::*;
if let ExprIf(ref pred, ref then_block, Some(ref else_expr)) = e.node { if let ExprIf(ref pred, ref then_block, Some(ref else_expr)) = e.node {
let reduce = |ret, not| { let reduce = |ret, not| {
@ -116,8 +116,8 @@ impl LintPass for BoolComparison {
} }
} }
impl LateLintPass for BoolComparison { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BoolComparison {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
use self::Expression::*; use self::Expression::*;
if let ExprBinary(Spanned { node: BiEq, .. }, ref left_side, ref right_side) = e.node { if let ExprBinary(Spanned { node: BiEq, .. }, ref left_side, ref right_side) = e.node {
match (fetch_bool_expr(left_side), fetch_bool_expr(right_side)) { match (fetch_bool_expr(left_side), fetch_bool_expr(right_side)) {

View file

@ -34,8 +34,8 @@ impl LintPass for NeedlessBorrow {
} }
} }
impl LateLintPass for NeedlessBorrow { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessBorrow {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
if in_macro(cx, e.span) { if in_macro(cx, e.span) {
return; return;
} }
@ -53,7 +53,7 @@ impl LateLintPass for NeedlessBorrow {
} }
} }
} }
fn check_pat<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, pat: &'tcx Pat) { fn check_pat(&mut self, cx: &LateContext<'a, 'tcx>, pat: &'tcx Pat) {
if in_macro(cx, pat.span) { if in_macro(cx, pat.span) {
return; return;
} }

View file

@ -30,8 +30,8 @@ impl LintPass for Pass {
} }
} }
impl LateLintPass for Pass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
if let ExprStruct(_, ref fields, Some(ref base)) = expr.node { if let ExprStruct(_, ref fields, Some(ref base)) = expr.node {
let ty = cx.tcx.tables().expr_ty(expr); let ty = cx.tcx.tables().expr_ty(expr);
if let TyAdt(def, _) = ty.sty { if let TyAdt(def, _) = ty.sty {

View file

@ -31,8 +31,8 @@ impl LintPass for NegMultiply {
} }
#[allow(match_same_arms)] #[allow(match_same_arms)]
impl LateLintPass for NegMultiply { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NegMultiply {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
if let ExprBinary(Spanned { node: BiMul, .. }, ref l, ref r) = e.node { if let ExprBinary(Spanned { node: BiMul, .. }, ref l, ref r) = e.node {
match (&l.node, &r.node) { match (&l.node, &r.node) {
(&ExprUnary(..), &ExprUnary(..)) => (), (&ExprUnary(..), &ExprUnary(..)) => (),

View file

@ -89,8 +89,8 @@ impl LintPass for NewWithoutDefault {
} }
} }
impl LateLintPass for NewWithoutDefault { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault {
fn check_fn<'a, 'tcx: 'a>( fn check_fn(
&mut self, &mut self,
cx: &LateContext<'a, 'tcx>, cx: &LateContext<'a, 'tcx>,
kind: FnKind<'tcx>, kind: FnKind<'tcx>,

View file

@ -102,8 +102,8 @@ impl LintPass for Pass {
} }
} }
impl LateLintPass for Pass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
fn check_stmt<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, stmt: &'tcx Stmt) { fn check_stmt(&mut self, cx: &LateContext<'a, 'tcx>, stmt: &'tcx Stmt) {
if let StmtSemi(ref expr, _) = stmt.node { if let StmtSemi(ref expr, _) = stmt.node {
if has_no_effect(cx, expr) { if has_no_effect(cx, expr) {
span_lint(cx, NO_EFFECT, stmt.span, "statement with no effect"); span_lint(cx, NO_EFFECT, stmt.span, "statement with no effect");

View file

@ -40,8 +40,8 @@ impl LintPass for Pass {
} }
} }
impl LateLintPass for Pass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
if_let_chain! {[ //begin checking variables if_let_chain! {[ //begin checking variables
let ExprMatch(ref op, ref body, ref source) = expr.node, //test if expr is a match let ExprMatch(ref op, ref body, ref source) = expr.node, //test if expr is a match
let MatchSource::IfLetDesugar { .. } = *source, //test if it is an If Let let MatchSource::IfLetDesugar { .. } = *source, //test if it is an If Let

View file

@ -32,8 +32,8 @@ impl LintPass for NonSensical {
} }
} }
impl LateLintPass for NonSensical { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSensical {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
if let ExprMethodCall(ref name, _, ref arguments) = e.node { if let ExprMethodCall(ref name, _, ref arguments) = e.node {
let (obj_ty, _) = walk_ptrs_ty_depth(cx.tcx.tables().expr_ty(&arguments[0])); let (obj_ty, _) = walk_ptrs_ty_depth(cx.tcx.tables().expr_ty(&arguments[0]));
if &*name.node.as_str() == "open" && match_type(cx, obj_ty, &paths::OPEN_OPTIONS) { if &*name.node.as_str() == "open" && match_type(cx, obj_ty, &paths::OPEN_OPTIONS) {

View file

@ -29,9 +29,9 @@ impl LintPass for OverflowCheckConditional {
} }
} }
impl LateLintPass for OverflowCheckConditional { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for OverflowCheckConditional {
// a + b < a, a > a + b, a < a - b, a - b > a // a + b < a, a > a + b, a < a - b, a - b > a
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
if_let_chain! {[ if_let_chain! {[
let Expr_::ExprBinary(ref op, ref first, ref second) = expr.node, let Expr_::ExprBinary(ref op, ref first, ref second) = expr.node,
let Expr_::ExprBinary(ref op2, ref ident1, ref ident2) = first.node, let Expr_::ExprBinary(ref op2, ref ident1, ref ident2) = first.node,

View file

@ -32,8 +32,8 @@ impl LintPass for Pass {
} }
} }
impl LateLintPass for Pass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
if_let_chain! {[ if_let_chain! {[
let ExprBlock(ref block) = expr.node, let ExprBlock(ref block) = expr.node,
let Some(ref ex) = block.expr, let Some(ref ex) = block.expr,

View file

@ -35,8 +35,8 @@ impl LintPass for Pass {
} }
} }
impl LateLintPass for Pass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
fn check_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
if_let_chain! {[ if_let_chain! {[
let ItemImpl(_, _, _, Some(ref trait_ref), _, ref impl_items) = item.node, let ItemImpl(_, _, _, Some(ref trait_ref), _, ref impl_items) = item.node,
!is_automatically_derived(&*item.attrs), !is_automatically_derived(&*item.attrs),

View file

@ -65,8 +65,8 @@ impl LintPass for Pass {
} }
} }
impl LateLintPass for Pass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
if_let_chain! {[ if_let_chain! {[
let ExprCall(ref fun, ref args) = expr.node, let ExprCall(ref fun, ref args) = expr.node,
let ExprPath(ref qpath) = fun.node, let ExprPath(ref qpath) = fun.node,

View file

@ -54,14 +54,14 @@ impl LintPass for PointerPass {
} }
} }
impl LateLintPass for PointerPass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PointerPass {
fn check_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
if let ItemFn(ref decl, _, _, _, _, _) = item.node { if let ItemFn(ref decl, _, _, _, _, _) = item.node {
check_fn(cx, decl, item.id); check_fn(cx, decl, item.id);
} }
} }
fn check_impl_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx ImplItem) { fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx ImplItem) {
if let ImplItemKind::Method(ref sig, _) = item.node { if let ImplItemKind::Method(ref sig, _) = item.node {
if let Some(NodeItem(it)) = cx.tcx.map.find(cx.tcx.map.get_parent(item.id)) { if let Some(NodeItem(it)) = cx.tcx.map.find(cx.tcx.map.get_parent(item.id)) {
if let ItemImpl(_, _, _, Some(_), _, _) = it.node { if let ItemImpl(_, _, _, Some(_), _, _) = it.node {
@ -72,13 +72,13 @@ impl LateLintPass for PointerPass {
} }
} }
fn check_trait_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx TraitItem) { fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx TraitItem) {
if let MethodTraitItem(ref sig, _) = item.node { if let MethodTraitItem(ref sig, _) = item.node {
check_fn(cx, &sig.decl, item.id); check_fn(cx, &sig.decl, item.id);
} }
} }
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
if let ExprBinary(ref op, ref l, ref r) = expr.node { if let ExprBinary(ref op, ref l, ref r) = expr.node {
if (op.node == BiEq || op.node == BiNe) && (is_null_path(l) || is_null_path(r)) { if (op.node == BiEq || op.node == BiNe) && (is_null_path(l) || is_null_path(r)) {
span_lint(cx, span_lint(cx,

View file

@ -46,8 +46,8 @@ impl LintPass for StepByZero {
} }
} }
impl LateLintPass for StepByZero { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for StepByZero {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
if let ExprMethodCall(Spanned { node: ref name, .. }, _, ref args) = expr.node { if let ExprMethodCall(Spanned { node: ref name, .. }, _, ref args) = expr.node {
let name = &*name.as_str(); let name = &*name.as_str();

View file

@ -82,12 +82,12 @@ impl LintPass for Pass {
} }
} }
impl LateLintPass for Pass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
fn check_crate<'a, 'tcx: 'a>(&mut self, _: &LateContext<'a, 'tcx>, _: &'tcx Crate) { fn check_crate(&mut self, _: &LateContext<'a, 'tcx>, _: &'tcx Crate) {
self.spans.clear(); self.spans.clear();
} }
fn check_block<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, block: &'tcx Block) { fn check_block(&mut self, cx: &LateContext<'a, 'tcx>, block: &'tcx Block) {
if_let_chain!{[ if_let_chain!{[
self.last.is_none(), self.last.is_none(),
let Some(ref expr) = block.expr, let Some(ref expr) = block.expr,
@ -106,13 +106,13 @@ impl LateLintPass for Pass {
}} }}
} }
fn check_block_post<'a, 'tcx: 'a>(&mut self, _: &LateContext<'a, 'tcx>, block: &'tcx Block) { fn check_block_post(&mut self, _: &LateContext<'a, 'tcx>, block: &'tcx Block) {
if self.last.map_or(false, |id| block.id == id) { if self.last.map_or(false, |id| block.id == id) {
self.last = None; self.last = None;
} }
} }
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
if_let_chain!{[ if_let_chain!{[
let ExprCall(ref fun, ref args) = expr.node, let ExprCall(ref fun, ref args) = expr.node,
let ExprPath(ref qpath) = fun.node, let ExprPath(ref qpath) = fun.node,

View file

@ -26,8 +26,8 @@ impl LintPass for Serde {
} }
} }
impl LateLintPass for Serde { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Serde {
fn check_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
if let ItemImpl(_, _, _, Some(ref trait_ref), _, ref items) = item.node { if let ItemImpl(_, _, _, Some(ref trait_ref), _, ref items) = item.node {
let did = trait_ref.path.def.def_id(); let did = trait_ref.path.def.def_id();
if let Some(visit_did) = get_trait_def_id(cx, &paths::SERDE_DE_VISITOR) { if let Some(visit_did) = get_trait_def_id(cx, &paths::SERDE_DE_VISITOR) {

View file

@ -79,8 +79,8 @@ impl LintPass for Pass {
} }
} }
impl LateLintPass for Pass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
fn check_fn<'a, 'tcx: 'a>( fn check_fn(
&mut self, &mut self,
cx: &LateContext<'a, 'tcx>, cx: &LateContext<'a, 'tcx>,
_: FnKind<'tcx>, _: FnKind<'tcx>,
@ -96,7 +96,7 @@ impl LateLintPass for Pass {
} }
} }
fn check_fn<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, decl: &'tcx FnDecl, expr: &'tcx Expr) { fn check_fn<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, decl: &'tcx FnDecl, expr: &'tcx Expr) {
let mut bindings = Vec::new(); let mut bindings = Vec::new();
for arg in &decl.inputs { for arg in &decl.inputs {
if let PatKind::Binding(_, _, ident, _) = arg.pat.node { if let PatKind::Binding(_, _, ident, _) = arg.pat.node {
@ -106,7 +106,7 @@ fn check_fn<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, decl: &'tcx FnDecl, expr:
check_expr(cx, expr, &mut bindings); check_expr(cx, expr, &mut bindings);
} }
fn check_block<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, block: &'tcx Block, bindings: &mut Vec<(Name, Span)>) { fn check_block<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, block: &'tcx Block, bindings: &mut Vec<(Name, Span)>) {
let len = bindings.len(); let len = bindings.len();
for stmt in &block.stmts { for stmt in &block.stmts {
match stmt.node { match stmt.node {
@ -121,7 +121,7 @@ fn check_block<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, block: &'tcx Block, bin
bindings.truncate(len); bindings.truncate(len);
} }
fn check_decl<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, decl: &'tcx Decl, bindings: &mut Vec<(Name, Span)>) { fn check_decl<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, decl: &'tcx Decl, bindings: &mut Vec<(Name, Span)>) {
if in_external_macro(cx, decl.span) { if in_external_macro(cx, decl.span) {
return; return;
} }
@ -150,7 +150,7 @@ fn is_binding(cx: &LateContext, pat_id: NodeId) -> bool {
} }
} }
fn check_pat<'a, 'tcx: 'a>( fn check_pat<'a, 'tcx>(
cx: &LateContext<'a, 'tcx>, cx: &LateContext<'a, 'tcx>,
pat: &'tcx Pat, pat: &'tcx Pat,
init: Option<&'tcx Expr>, init: Option<&'tcx Expr>,
@ -285,7 +285,7 @@ fn lint_shadow<'a, 'tcx: 'a>(
} }
} }
fn check_expr<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr, bindings: &mut Vec<(Name, Span)>) { fn check_expr<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr, bindings: &mut Vec<(Name, Span)>) {
if in_external_macro(cx, expr.span) { if in_external_macro(cx, expr.span) {
return; return;
} }
@ -334,7 +334,7 @@ fn check_expr<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr, bindin
} }
} }
fn check_ty<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, ty: &'tcx Ty, bindings: &mut Vec<(Name, Span)>) { fn check_ty<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: &'tcx Ty, bindings: &mut Vec<(Name, Span)>) {
match ty.node { match ty.node {
TyObjectSum(ref sty, _) | TyObjectSum(ref sty, _) |
TySlice(ref sty) => check_ty(cx, sty, bindings), TySlice(ref sty) => check_ty(cx, sty, bindings),

View file

@ -79,8 +79,8 @@ impl LintPass for StringAdd {
} }
} }
impl LateLintPass for StringAdd { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for StringAdd {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
if let ExprBinary(Spanned { node: BiAdd, .. }, ref left, _) = e.node { if let ExprBinary(Spanned { node: BiAdd, .. }, ref left, _) = e.node {
if is_string(cx, left) { if is_string(cx, left) {
if let Allow = cx.current_level(STRING_ADD_ASSIGN) { if let Allow = cx.current_level(STRING_ADD_ASSIGN) {
@ -136,8 +136,8 @@ impl LintPass for StringLitAsBytes {
} }
} }
impl LateLintPass for StringLitAsBytes { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for StringLitAsBytes {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
use std::ascii::AsciiExt; use std::ascii::AsciiExt;
use syntax::ast::LitKind; use syntax::ast::LitKind;
use utils::{snippet, in_macro}; use utils::{snippet, in_macro};

View file

@ -50,8 +50,8 @@ impl LintPass for Swap {
} }
} }
impl LateLintPass for Swap { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Swap {
fn check_block<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, block: &'tcx Block) { fn check_block(&mut self, cx: &LateContext<'a, 'tcx>, block: &'tcx Block) {
check_manual_swap(cx, block); check_manual_swap(cx, block);
check_suspicious_swap(cx, block); check_suspicious_swap(cx, block);
} }

View file

@ -37,8 +37,8 @@ impl LintPass for Pass {
} }
} }
impl LateLintPass for Pass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
if let ExprAssign(ref target, _) = expr.node { if let ExprAssign(ref target, _) = expr.node {
match target.node { match target.node {
ExprField(ref base, _) | ExprField(ref base, _) |

View file

@ -84,8 +84,8 @@ impl LintPass for Transmute {
} }
} }
impl LateLintPass for Transmute { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Transmute {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
if let ExprCall(ref path_expr, ref args) = e.node { if let ExprCall(ref path_expr, ref args) = e.node {
if let ExprPath(ref qpath) = path_expr.node { if let ExprPath(ref qpath) = path_expr.node {
let def_id = cx.tcx.tables().qpath_def(qpath, path_expr.id).def_id(); let def_id = cx.tcx.tables().qpath_def(qpath, path_expr.id).def_id();

View file

@ -69,8 +69,8 @@ impl LintPass for TypePass {
} }
} }
impl LateLintPass for TypePass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypePass {
fn check_ty<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, ast_ty: &'tcx Ty) { fn check_ty(&mut self, cx: &LateContext<'a, 'tcx>, ast_ty: &'tcx Ty) {
if in_macro(cx, ast_ty.span) { if in_macro(cx, ast_ty.span) {
return; return;
} }
@ -153,8 +153,8 @@ impl LintPass for LetPass {
} }
} }
impl LateLintPass for LetPass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LetPass {
fn check_decl<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, decl: &'tcx Decl) { fn check_decl(&mut self, cx: &LateContext<'a, 'tcx>, decl: &'tcx Decl) {
check_let_unit(cx, decl) check_let_unit(cx, decl)
} }
} }
@ -190,8 +190,8 @@ impl LintPass for UnitCmp {
} }
} }
impl LateLintPass for UnitCmp { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnitCmp {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
if in_macro(cx, expr.span) { if in_macro(cx, expr.span) {
return; return;
} }
@ -447,8 +447,8 @@ impl LintPass for CastPass {
} }
} }
impl LateLintPass for CastPass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CastPass {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
if let ExprCast(ref ex, _) = expr.node { if let ExprCast(ref ex, _) = expr.node {
let (cast_from, cast_to) = (cx.tcx.tables().expr_ty(ex), cx.tcx.tables().expr_ty(expr)); let (cast_from, cast_to) = (cx.tcx.tables().expr_ty(ex), cx.tcx.tables().expr_ty(expr));
if cast_from.is_numeric() && cast_to.is_numeric() && !in_external_macro(cx, expr.span) { if cast_from.is_numeric() && cast_to.is_numeric() && !in_external_macro(cx, expr.span) {
@ -535,17 +535,17 @@ impl LintPass for TypeComplexityPass {
} }
} }
impl LateLintPass for TypeComplexityPass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeComplexityPass {
fn check_fn<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, _: FnKind<'tcx>, decl: &'tcx FnDecl, _: &'tcx Expr, _: Span, _: NodeId) { fn check_fn(&mut self, cx: &LateContext<'a, 'tcx>, _: FnKind<'tcx>, decl: &'tcx FnDecl, _: &'tcx Expr, _: Span, _: NodeId) {
self.check_fndecl(cx, decl); self.check_fndecl(cx, decl);
} }
fn check_struct_field<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, field: &'tcx StructField) { fn check_struct_field(&mut self, cx: &LateContext<'a, 'tcx>, field: &'tcx StructField) {
// enum variants are also struct fields now // enum variants are also struct fields now
self.check_type(cx, &field.ty); self.check_type(cx, &field.ty);
} }
fn check_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
match item.node { match item.node {
ItemStatic(ref ty, _, _) | ItemStatic(ref ty, _, _) |
ItemConst(ref ty, _) => self.check_type(cx, ty), ItemConst(ref ty, _) => self.check_type(cx, ty),
@ -554,7 +554,7 @@ impl LateLintPass for TypeComplexityPass {
} }
} }
fn check_trait_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx TraitItem) { fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx TraitItem) {
match item.node { match item.node {
ConstTraitItem(ref ty, _) | ConstTraitItem(ref ty, _) |
TypeTraitItem(_, Some(ref ty)) => self.check_type(cx, ty), TypeTraitItem(_, Some(ref ty)) => self.check_type(cx, ty),
@ -564,7 +564,7 @@ impl LateLintPass for TypeComplexityPass {
} }
} }
fn check_impl_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx ImplItem) { fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx ImplItem) {
match item.node { match item.node {
ImplItemKind::Const(ref ty, _) | ImplItemKind::Const(ref ty, _) |
ImplItemKind::Type(ref ty) => self.check_type(cx, ty), ImplItemKind::Type(ref ty) => self.check_type(cx, ty),
@ -573,15 +573,15 @@ impl LateLintPass for TypeComplexityPass {
} }
} }
fn check_local<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, local: &'tcx Local) { fn check_local(&mut self, cx: &LateContext<'a, 'tcx>, local: &'tcx Local) {
if let Some(ref ty) = local.ty { if let Some(ref ty) = local.ty {
self.check_type(cx, ty); self.check_type(cx, ty);
} }
} }
} }
impl TypeComplexityPass { impl<'a, 'tcx> TypeComplexityPass {
fn check_fndecl<'a, 'tcx: 'a>(&self, cx: &LateContext<'a, 'tcx>, decl: &'tcx FnDecl) { fn check_fndecl(&self, cx: &LateContext<'a, 'tcx>, decl: &'tcx FnDecl) {
for arg in &decl.inputs { for arg in &decl.inputs {
self.check_type(cx, &arg.ty); self.check_type(cx, &arg.ty);
} }
@ -590,7 +590,7 @@ impl TypeComplexityPass {
} }
} }
fn check_type<'a, 'tcx: 'a>(&self, cx: &LateContext<'a, 'tcx>, ty: &'tcx Ty) { fn check_type(&self, cx: &LateContext<'a, 'tcx>, ty: &'tcx Ty) {
if in_macro(cx, ty.span) { if in_macro(cx, ty.span) {
return; return;
} }
@ -682,8 +682,8 @@ impl LintPass for CharLitAsU8 {
} }
} }
impl LateLintPass for CharLitAsU8 { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CharLitAsU8 {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
use syntax::ast::{LitKind, UintTy}; use syntax::ast::{LitKind, UintTy};
if let ExprCast(ref e, _) = expr.node { if let ExprCast(ref e, _) = expr.node {
@ -846,8 +846,8 @@ fn detect_extreme_expr<'a>(cx: &LateContext, expr: &'a Expr) -> Option<ExtremeEx
}) })
} }
impl LateLintPass for AbsurdExtremeComparisons { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AbsurdExtremeComparisons {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
use types::ExtremeType::*; use types::ExtremeType::*;
use types::AbsurdComparisonResult::*; use types::AbsurdComparisonResult::*;
@ -1071,8 +1071,8 @@ fn upcast_comparison_bounds_err(cx: &LateContext, span: &Span, rel: comparisons:
} }
} }
impl LateLintPass for InvalidUpcastComparisons { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidUpcastComparisons {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
if let ExprBinary(ref cmp, ref lhs, ref rhs) = expr.node { if let ExprBinary(ref cmp, ref lhs, ref rhs) = expr.node {
let normalized = comparisons::normalize_comparison(cmp.node, lhs, rhs); let normalized = comparisons::normalize_comparison(cmp.node, lhs, rhs);

View file

@ -68,8 +68,8 @@ impl LintPass for Unicode {
} }
} }
impl LateLintPass for Unicode { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Unicode {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
if let ExprLit(ref lit) = expr.node { if let ExprLit(ref lit) = expr.node {
if let LitKind::Str(_, _) = lit.node { if let LitKind::Str(_, _) = lit.node {
check_str(cx, lit.span) check_str(cx, lit.span)

View file

@ -40,8 +40,8 @@ impl LintPass for UnusedLabel {
} }
} }
impl LateLintPass for UnusedLabel { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedLabel {
fn check_fn<'a, 'tcx: 'a>( fn check_fn(
&mut self, &mut self,
cx: &LateContext<'a, 'tcx>, cx: &LateContext<'a, 'tcx>,
kind: FnKind<'tcx>, kind: FnKind<'tcx>,

View file

@ -36,15 +36,15 @@ impl LintPass for Pass {
} }
} }
impl LateLintPass for Pass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
fn check_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item) { fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item) {
if !has_attr(&item.attrs) { if !has_attr(&item.attrs) {
return; return;
} }
print_item(cx, item); print_item(cx, item);
} }
fn check_impl_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::ImplItem) { fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::ImplItem) {
if !has_attr(&item.attrs) { if !has_attr(&item.attrs) {
return; return;
} }
@ -68,33 +68,33 @@ impl LateLintPass for Pass {
} }
} }
/* /*
fn check_trait_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::TraitItem) { fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::TraitItem) {
if !has_attr(&item.attrs) { if !has_attr(&item.attrs) {
return; return;
} }
} }
fn check_variant<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, var: &'tcx hir::Variant, _: &hir::Generics) { fn check_variant(&mut self, cx: &LateContext<'a, 'tcx>, var: &'tcx hir::Variant, _: &hir::Generics) {
if !has_attr(&var.node.attrs) { if !has_attr(&var.node.attrs) {
return; return;
} }
} }
fn check_struct_field<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, field: &'tcx hir::StructField) { fn check_struct_field(&mut self, cx: &LateContext<'a, 'tcx>, field: &'tcx hir::StructField) {
if !has_attr(&field.attrs) { if !has_attr(&field.attrs) {
return; return;
} }
} }
*/ */
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr) {
if !has_attr(&expr.attrs) { if !has_attr(&expr.attrs) {
return; return;
} }
print_expr(cx, expr, 0); print_expr(cx, expr, 0);
} }
fn check_arm<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, arm: &'tcx hir::Arm) { fn check_arm(&mut self, cx: &LateContext<'a, 'tcx>, arm: &'tcx hir::Arm) {
if !has_attr(&arm.attrs) { if !has_attr(&arm.attrs) {
return; return;
} }
@ -109,7 +109,7 @@ impl LateLintPass for Pass {
print_expr(cx, &arm.body, 1); print_expr(cx, &arm.body, 1);
} }
fn check_stmt<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, stmt: &'tcx hir::Stmt) { fn check_stmt(&mut self, cx: &LateContext<'a, 'tcx>, stmt: &'tcx hir::Stmt) {
if !has_attr(stmt.node.attrs()) { if !has_attr(stmt.node.attrs()) {
return; return;
} }
@ -120,7 +120,7 @@ impl LateLintPass for Pass {
} }
/* /*
fn check_foreign_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::ForeignItem) { fn check_foreign_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::ForeignItem) {
if !has_attr(&item.attrs) { if !has_attr(&item.attrs) {
return; return;
} }

View file

@ -104,8 +104,8 @@ impl LintPass for LintWithoutLintPass {
} }
impl LateLintPass for LintWithoutLintPass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LintWithoutLintPass {
fn check_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
if let ItemStatic(ref ty, MutImmutable, ref expr) = item.node { if let ItemStatic(ref ty, MutImmutable, ref expr) = item.node {
if is_lint_ref_type(ty) { if is_lint_ref_type(ty) {
self.declared_lints.insert(item.name, item.span); self.declared_lints.insert(item.name, item.span);
@ -116,7 +116,7 @@ impl LateLintPass for LintWithoutLintPass {
} }
} }
fn check_crate_post<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, _: &'tcx Crate) { fn check_crate_post(&mut self, cx: &LateContext<'a, 'tcx>, _: &'tcx Crate) {
for (lint_name, &lint_span) in &self.declared_lints { for (lint_name, &lint_span) in &self.declared_lints {
// When using the `declare_lint!` macro, the original `lint_span`'s // When using the `declare_lint!` macro, the original `lint_span`'s
// file points to "<rustc macros>". // file points to "<rustc macros>".

View file

@ -32,8 +32,8 @@ impl LintPass for Pass {
} }
} }
impl LateLintPass for Pass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
// search for `&vec![_]` expressions where the adjusted type is `&[_]` // search for `&vec![_]` expressions where the adjusted type is `&[_]`
if_let_chain!{[ if_let_chain!{[
let ty::TypeVariants::TyRef(_, ref ty) = cx.tcx.tables().expr_ty_adjusted(expr).sty, let ty::TypeVariants::TyRef(_, ref ty) = cx.tcx.tables().expr_ty_adjusted(expr).sty,

View file

@ -27,8 +27,8 @@ impl LintPass for Pass {
} }
} }
impl LateLintPass for Pass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
// check for instances of 0.0/0.0 // check for instances of 0.0/0.0
if_let_chain! {[ if_let_chain! {[
let ExprBinary(ref op, ref left, ref right) = expr.node, let ExprBinary(ref op, ref left, ref right) = expr.node,