From 778ce4dfd359eb8071ad76aa6447b23ce7a0c752 Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Wed, 7 Dec 2016 13:13:40 +0100 Subject: [PATCH] update to the rust-PR that unblocks clippy --- clippy_lints/src/approx_const.rs | 4 +- clippy_lints/src/arithmetic.rs | 6 +-- clippy_lints/src/array_indexing.rs | 4 +- clippy_lints/src/assign_ops.rs | 4 +- clippy_lints/src/attrs.rs | 10 ++-- clippy_lints/src/bit_mask.rs | 4 +- clippy_lints/src/blacklisted_name.rs | 4 +- clippy_lints/src/block_in_if_condition.rs | 4 +- clippy_lints/src/booleans.rs | 4 +- clippy_lints/src/copies.rs | 4 +- clippy_lints/src/cyclomatic_complexity.rs | 12 ++--- clippy_lints/src/derive.rs | 6 +-- clippy_lints/src/drop_ref.rs | 4 +- clippy_lints/src/entry.rs | 4 +- clippy_lints/src/enum_clike.rs | 4 +- clippy_lints/src/enum_glob_use.rs | 4 +- clippy_lints/src/eq_op.rs | 4 +- clippy_lints/src/escape.rs | 4 +- clippy_lints/src/eta_reduction.rs | 4 +- clippy_lints/src/eval_order_dependence.rs | 10 ++-- clippy_lints/src/format.rs | 4 +- clippy_lints/src/functions.rs | 10 ++-- clippy_lints/src/identity_op.rs | 4 +- .../src/if_let_redundant_pattern_matching.rs | 4 +- clippy_lints/src/len_zero.rs | 6 +-- clippy_lints/src/let_if_seq.rs | 6 +-- clippy_lints/src/lifetimes.rs | 10 ++-- clippy_lints/src/loops.rs | 14 +++--- clippy_lints/src/map_clone.rs | 4 +- clippy_lints/src/matches.rs | 4 +- clippy_lints/src/mem_forget.rs | 4 +- clippy_lints/src/methods.rs | 6 +-- clippy_lints/src/minmax.rs | 4 +- clippy_lints/src/misc.rs | 10 ++-- clippy_lints/src/missing_doc.rs | 18 +++---- clippy_lints/src/mut_mut.rs | 6 +-- clippy_lints/src/mut_reference.rs | 4 +- clippy_lints/src/mutex_atomic.rs | 4 +- clippy_lints/src/needless_bool.rs | 8 ++-- clippy_lints/src/needless_borrow.rs | 6 +-- clippy_lints/src/needless_update.rs | 4 +- clippy_lints/src/neg_multiply.rs | 4 +- clippy_lints/src/new_without_default.rs | 4 +- clippy_lints/src/no_effect.rs | 4 +- clippy_lints/src/ok_if_let.rs | 4 +- clippy_lints/src/open_options.rs | 4 +- .../src/overflow_check_conditional.rs | 4 +- clippy_lints/src/panic.rs | 4 +- clippy_lints/src/partialeq_ne_impl.rs | 4 +- clippy_lints/src/print.rs | 4 +- clippy_lints/src/ptr.rs | 10 ++-- clippy_lints/src/ranges.rs | 4 +- clippy_lints/src/regex.rs | 10 ++-- clippy_lints/src/serde.rs | 4 +- clippy_lints/src/shadow.rs | 16 +++---- clippy_lints/src/strings.rs | 8 ++-- clippy_lints/src/swap.rs | 4 +- clippy_lints/src/temporary_assignment.rs | 4 +- clippy_lints/src/transmute.rs | 4 +- clippy_lints/src/types.rs | 48 +++++++++---------- clippy_lints/src/unicode.rs | 4 +- clippy_lints/src/unused_label.rs | 4 +- clippy_lints/src/utils/inspector.rs | 20 ++++---- clippy_lints/src/utils/internal_lints.rs | 6 +-- clippy_lints/src/vec.rs | 4 +- clippy_lints/src/zero_div_zero.rs | 4 +- 66 files changed, 217 insertions(+), 217 deletions(-) diff --git a/clippy_lints/src/approx_const.rs b/clippy_lints/src/approx_const.rs index 9a6678f176a1..3ccb5f6ef2a0 100644 --- a/clippy_lints/src/approx_const.rs +++ b/clippy_lints/src/approx_const.rs @@ -59,8 +59,8 @@ impl LintPass for Pass { } } -impl LateLintPass for Pass { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { if let ExprLit(ref lit) = e.node { check_lit(cx, lit, e); } diff --git a/clippy_lints/src/arithmetic.rs b/clippy_lints/src/arithmetic.rs index 0ae64e0e7872..5020295e20c9 100644 --- a/clippy_lints/src/arithmetic.rs +++ b/clippy_lints/src/arithmetic.rs @@ -47,8 +47,8 @@ impl LintPass for Arithmetic { } } -impl LateLintPass for Arithmetic { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Arithmetic { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr) { if self.span.is_some() { 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 { self.span = None; } diff --git a/clippy_lints/src/array_indexing.rs b/clippy_lints/src/array_indexing.rs index 1f68c32cd24f..399f93d08c7c 100644 --- a/clippy_lints/src/array_indexing.rs +++ b/clippy_lints/src/array_indexing.rs @@ -55,8 +55,8 @@ impl LintPass for ArrayIndexing { } } -impl LateLintPass for ArrayIndexing { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx hir::Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ArrayIndexing { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx hir::Expr) { if let hir::ExprIndex(ref array, ref index) = e.node { // Array with known size can be checked statically let ty = cx.tcx.tables().expr_ty(array); diff --git a/clippy_lints/src/assign_ops.rs b/clippy_lints/src/assign_ops.rs index 84b61b1cba42..ef6898cef885 100644 --- a/clippy_lints/src/assign_ops.rs +++ b/clippy_lints/src/assign_ops.rs @@ -66,8 +66,8 @@ impl LintPass for AssignOps { } } -impl LateLintPass for AssignOps { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr) { match expr.node { hir::ExprAssignOp(op, ref lhs, ref rhs) => { span_lint_and_then(cx, ASSIGN_OPS, expr.span, "assign operation detected", |db| { diff --git a/clippy_lints/src/attrs.rs b/clippy_lints/src/attrs.rs index 5ddbeb570468..a37b08363957 100644 --- a/clippy_lints/src/attrs.rs +++ b/clippy_lints/src/attrs.rs @@ -81,8 +81,8 @@ impl LintPass for AttrPass { } } -impl LateLintPass for AttrPass { - fn check_attribute<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, attr: &'tcx Attribute) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass { + fn check_attribute(&mut self, cx: &LateContext<'a, 'tcx>, attr: &'tcx Attribute) { if let MetaItemKind::List(ref items) = attr.value.node { if items.is_empty() || attr.name() != "deprecated" { 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) { 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) { 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) { check_attrs(cx, item.span, &item.name, &item.attrs) } diff --git a/clippy_lints/src/bit_mask.rs b/clippy_lints/src/bit_mask.rs index fb305f8907d5..0e569bc76f7b 100644 --- a/clippy_lints/src/bit_mask.rs +++ b/clippy_lints/src/bit_mask.rs @@ -79,8 +79,8 @@ impl LintPass for BitMask { } } -impl LateLintPass for BitMask { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BitMask { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { if let ExprBinary(ref cmp, ref left, ref right) = e.node { if cmp.node.is_comparison() { if let Some(cmp_opt) = fetch_int_literal(cx, right) { diff --git a/clippy_lints/src/blacklisted_name.rs b/clippy_lints/src/blacklisted_name.rs index 542bf0a4f285..2f9a50fe3dac 100644 --- a/clippy_lints/src/blacklisted_name.rs +++ b/clippy_lints/src/blacklisted_name.rs @@ -37,8 +37,8 @@ impl LintPass for BlackListedName { } } -impl LateLintPass for BlackListedName { - fn check_pat<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, pat: &'tcx Pat) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BlackListedName { + fn check_pat(&mut self, cx: &LateContext<'a, 'tcx>, pat: &'tcx Pat) { if let PatKind::Binding(_, _, ref ident, _) = pat.node { if self.blacklist.iter().any(|s| s == &*ident.node.as_str()) { span_lint(cx, diff --git a/clippy_lints/src/block_in_if_condition.rs b/clippy_lints/src/block_in_if_condition.rs index 1ac96bf6bcaf..de004afa1a6c 100644 --- a/clippy_lints/src/block_in_if_condition.rs +++ b/clippy_lints/src/block_in_if_condition.rs @@ -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; \ instead, move the block or closure higher and bind it with a 'let'"; -impl LateLintPass for BlockInIfCondition { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BlockInIfCondition { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { if let ExprIf(ref check, ref then, _) = expr.node { if let ExprBlock(ref block) = check.node { if block.rules == DefaultBlock { diff --git a/clippy_lints/src/booleans.rs b/clippy_lints/src/booleans.rs index 64c575046a21..bd5657483112 100644 --- a/clippy_lints/src/booleans.rs +++ b/clippy_lints/src/booleans.rs @@ -53,8 +53,8 @@ impl LintPass for NonminimalBool { } } -impl LateLintPass for NonminimalBool { - fn check_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonminimalBool { + fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { NonminimalBoolVisitor { cx: cx }.visit_item(item) } } diff --git a/clippy_lints/src/copies.rs b/clippy_lints/src/copies.rs index 1931b5d1e3f6..9fa38ad02b3e 100644 --- a/clippy_lints/src/copies.rs +++ b/clippy_lints/src/copies.rs @@ -109,8 +109,8 @@ impl LintPass for CopyAndPaste { } } -impl LateLintPass for CopyAndPaste { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CopyAndPaste { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { if !in_macro(cx, expr.span) { // 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) { diff --git a/clippy_lints/src/cyclomatic_complexity.rs b/clippy_lints/src/cyclomatic_complexity.rs index 67066d32cc3e..164633b7c644 100644 --- a/clippy_lints/src/cyclomatic_complexity.rs +++ b/clippy_lints/src/cyclomatic_complexity.rs @@ -90,8 +90,8 @@ impl CyclomaticComplexity { } } -impl LateLintPass for CyclomaticComplexity { - fn check_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CyclomaticComplexity { + fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { if let ItemFn(_, _, _, _, _, eid) = item.node { if !attr::contains_name(&item.attrs, "test") { 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 { 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 { 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"); } - 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"); } } diff --git a/clippy_lints/src/derive.rs b/clippy_lints/src/derive.rs index 4e9f7d9c6645..449227c97679 100644 --- a/clippy_lints/src/derive.rs +++ b/clippy_lints/src/derive.rs @@ -70,8 +70,8 @@ impl LintPass for Derive { } } -impl LateLintPass for Derive { - fn check_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Derive { + fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { if let ItemImpl(_, _, _, Some(ref trait_ref), _, _) = item.node { let ty = cx.tcx.item_type(cx.tcx.map.local_def_id(item.id)); 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. -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) { if_let_chain! {[ match_path_old(&trait_ref.path, &paths::HASH), diff --git a/clippy_lints/src/drop_ref.rs b/clippy_lints/src/drop_ref.rs index c16d879ec2f5..106e43e1b6f5 100644 --- a/clippy_lints/src/drop_ref.rs +++ b/clippy_lints/src/drop_ref.rs @@ -35,8 +35,8 @@ impl LintPass for Pass { } } -impl LateLintPass for Pass { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { if let ExprCall(ref path, ref args) = expr.node { if let ExprPath(ref qpath) = path.node { let def_id = cx.tcx.tables().qpath_def(qpath, path.id).def_id(); diff --git a/clippy_lints/src/entry.rs b/clippy_lints/src/entry.rs index 133d2dc68f92..00a41c2e986c 100644 --- a/clippy_lints/src/entry.rs +++ b/clippy_lints/src/entry.rs @@ -39,8 +39,8 @@ impl LintPass for HashMapLint { } } -impl LateLintPass for HashMapLint { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for HashMapLint { + 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 ExprUnary(UnOp::UnNot, ref check) = check.node { if let Some((ty, map, key)) = check_cond(cx, check) { diff --git a/clippy_lints/src/enum_clike.rs b/clippy_lints/src/enum_clike.rs index 28fd9833e25c..f4181da3c2b7 100644 --- a/clippy_lints/src/enum_clike.rs +++ b/clippy_lints/src/enum_clike.rs @@ -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)] - 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 { for var in &def.variants { let variant = &var.node; diff --git a/clippy_lints/src/enum_glob_use.rs b/clippy_lints/src/enum_glob_use.rs index 1db8607bd257..4dafcf365a6c 100644 --- a/clippy_lints/src/enum_glob_use.rs +++ b/clippy_lints/src/enum_glob_use.rs @@ -32,8 +32,8 @@ impl LintPass for EnumGlobUse { } } -impl LateLintPass for EnumGlobUse { - fn check_mod<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, m: &'tcx Mod, _: Span, _: NodeId) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EnumGlobUse { + fn check_mod(&mut self, cx: &LateContext<'a, 'tcx>, m: &'tcx Mod, _: Span, _: NodeId) { // only check top level `use` statements for item in &m.item_ids { self.lint_item(cx, cx.krate.item(item.id)); diff --git a/clippy_lints/src/eq_op.rs b/clippy_lints/src/eq_op.rs index 8cfeabba9fcb..c43dfe6e27ca 100644 --- a/clippy_lints/src/eq_op.rs +++ b/clippy_lints/src/eq_op.rs @@ -32,8 +32,8 @@ impl LintPass for EqOp { } } -impl LateLintPass for EqOp { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { 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) { span_lint(cx, diff --git a/clippy_lints/src/escape.rs b/clippy_lints/src/escape.rs index df01e0481a80..0ca1f143b164 100644 --- a/clippy_lints/src/escape.rs +++ b/clippy_lints/src/escape.rs @@ -60,8 +60,8 @@ impl LintPass for Pass { } } -impl LateLintPass for Pass { - fn check_fn<'a, 'tcx: 'a>( +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { + fn check_fn( &mut self, cx: &LateContext<'a, 'tcx>, _: visit::FnKind<'tcx>, diff --git a/clippy_lints/src/eta_reduction.rs b/clippy_lints/src/eta_reduction.rs index c8d468f7fa90..56308ed390d8 100644 --- a/clippy_lints/src/eta_reduction.rs +++ b/clippy_lints/src/eta_reduction.rs @@ -33,8 +33,8 @@ impl LintPass for EtaPass { } } -impl LateLintPass for EtaPass { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EtaPass { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { match expr.node { ExprCall(_, ref args) | ExprMethodCall(_, _, ref args) => { diff --git a/clippy_lints/src/eval_order_dependence.rs b/clippy_lints/src/eval_order_dependence.rs index 3a991b0f28b2..9e9a900fe7ab 100644 --- a/clippy_lints/src/eval_order_dependence.rs +++ b/clippy_lints/src/eval_order_dependence.rs @@ -56,8 +56,8 @@ impl LintPass for EvalOrderDependence { } } -impl LateLintPass for EvalOrderDependence { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EvalOrderDependence { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { // Find a write to a local variable. match expr.node { 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 { StmtExpr(ref e, _) | StmtSemi(ref e, _) => DivergenceVisitor { cx: cx }.maybe_walk_expr(e), StmtDecl(ref d, _) => { @@ -214,7 +214,7 @@ enum StopEarly { 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 { return StopEarly::KeepGoing; } @@ -263,7 +263,7 @@ fn check_expr<'a, 'tcx: 'a>(vis: & mut ReadVisitor<'a, 'tcx>, expr: &'tcx Expr) 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 { StmtExpr(ref expr, _) | StmtSemi(ref expr, _) => check_expr(vis, expr), diff --git a/clippy_lints/src/format.rs b/clippy_lints/src/format.rs index 236888fe191e..0cf4762364ba 100644 --- a/clippy_lints/src/format.rs +++ b/clippy_lints/src/format.rs @@ -38,8 +38,8 @@ impl LintPass for Pass { } } -impl LateLintPass for Pass { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { if let Some(span) = is_expn_of(cx, expr.span, "format") { match expr.node { // `format!("{}", foo)` expansion diff --git a/clippy_lints/src/functions.rs b/clippy_lints/src/functions.rs index 0d9a668e8b62..52461d08ee8d 100644 --- a/clippy_lints/src/functions.rs +++ b/clippy_lints/src/functions.rs @@ -68,8 +68,8 @@ impl LintPass for Functions { } } -impl LateLintPass for Functions { - fn check_fn<'a, 'tcx: 'a>( +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions { + fn check_fn( &mut self, cx: &LateContext<'a, 'tcx>, kind: intravisit::FnKind<'tcx>, @@ -105,7 +105,7 @@ impl LateLintPass for Functions { 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 { // don't lint extern functions decls, it's not their fault 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) { let args = decl.inputs.len() as u64; if args > self.threshold { @@ -131,7 +131,7 @@ impl Functions { } } - fn check_raw_ptr<'a, 'tcx: 'a>( + fn check_raw_ptr( &self, cx: &LateContext<'a, 'tcx>, unsafety: hir::Unsafety, diff --git a/clippy_lints/src/identity_op.rs b/clippy_lints/src/identity_op.rs index f360c59372bc..547aa23f0de8 100644 --- a/clippy_lints/src/identity_op.rs +++ b/clippy_lints/src/identity_op.rs @@ -31,8 +31,8 @@ impl LintPass for IdentityOp { } } -impl LateLintPass for IdentityOp { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for IdentityOp { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { if in_macro(cx, e.span) { return; } diff --git a/clippy_lints/src/if_let_redundant_pattern_matching.rs b/clippy_lints/src/if_let_redundant_pattern_matching.rs index bc834886db96..399b58956bd6 100644 --- a/clippy_lints/src/if_let_redundant_pattern_matching.rs +++ b/clippy_lints/src/if_let_redundant_pattern_matching.rs @@ -42,8 +42,8 @@ impl LintPass for Pass { } } -impl LateLintPass for Pass { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { if let ExprMatch(ref op, ref arms, MatchSource::IfLetDesugar{..}) = expr.node { diff --git a/clippy_lints/src/len_zero.rs b/clippy_lints/src/len_zero.rs index 98db74cff3a2..fd58f86d42f6 100644 --- a/clippy_lints/src/len_zero.rs +++ b/clippy_lints/src/len_zero.rs @@ -59,8 +59,8 @@ impl LintPass for LenZero { } } -impl LateLintPass for LenZero { - fn check_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LenZero { + fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { if in_macro(cx, item.span) { 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) { return; } diff --git a/clippy_lints/src/let_if_seq.rs b/clippy_lints/src/let_if_seq.rs index 1605505a6ae3..474a86cdb788 100644 --- a/clippy_lints/src/let_if_seq.rs +++ b/clippy_lints/src/let_if_seq.rs @@ -57,8 +57,8 @@ impl LintPass for LetIfSeq { } } -impl LateLintPass for LetIfSeq { - fn check_block<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, block: &'tcx hir::Block) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LetIfSeq { + fn check_block(&mut self, cx: &LateContext<'a, 'tcx>, block: &'tcx hir::Block) { let mut it = block.stmts.iter().peekable(); while let Some(stmt) = it.next() { 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>, decl: hir::def_id::DefId, block: &'tcx hir::Block, diff --git a/clippy_lints/src/lifetimes.rs b/clippy_lints/src/lifetimes.rs index 22e7384675fb..60132ad9161c 100644 --- a/clippy_lints/src/lifetimes.rs +++ b/clippy_lints/src/lifetimes.rs @@ -56,20 +56,20 @@ impl LintPass for LifetimePass { } } -impl LateLintPass for LifetimePass { - fn check_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LifetimePass { + fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { if let ItemFn(ref decl, _, _, _, ref generics, _) = item.node { 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 { 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 { 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>, decl: &'tcx FnDecl, generics: &'tcx Generics, diff --git a/clippy_lints/src/loops.rs b/clippy_lints/src/loops.rs index 233c62890096..77f2df03a6a4 100644 --- a/clippy_lints/src/loops.rs +++ b/clippy_lints/src/loops.rs @@ -307,8 +307,8 @@ impl LintPass for Pass { } } -impl LateLintPass for Pass { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { if let Some((pat, arg, body)) = higher::for_loop(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 ExprMethodCall(ref method, _, ref args) = expr.node { 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>, pat: &'tcx Pat, 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. /// 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>, pat: &'tcx Pat, 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>, arg: &'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. -fn check_for_loop_over_map_kv<'a, 'tcx: 'a>( +fn check_for_loop_over_map_kv<'a, 'tcx>( cx: &LateContext<'a, 'tcx>, pat: &'tcx Pat, arg: &'tcx Expr, diff --git a/clippy_lints/src/map_clone.rs b/clippy_lints/src/map_clone.rs index 416f9dcf93eb..4539c3c8c105 100644 --- a/clippy_lints/src/map_clone.rs +++ b/clippy_lints/src/map_clone.rs @@ -24,8 +24,8 @@ declare_lint! { #[derive(Copy, Clone)] pub struct Pass; -impl LateLintPass for Pass { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { // call to .map() if let ExprMethodCall(name, _, ref args) = expr.node { if &*name.node.as_str() == "map" && args.len() == 2 { diff --git a/clippy_lints/src/matches.rs b/clippy_lints/src/matches.rs index 0820a8137329..1d59afd9eace 100644 --- a/clippy_lints/src/matches.rs +++ b/clippy_lints/src/matches.rs @@ -129,8 +129,8 @@ impl LintPass for MatchPass { } } -impl LateLintPass for MatchPass { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MatchPass { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { if in_external_macro(cx, expr.span) { return; } diff --git a/clippy_lints/src/mem_forget.rs b/clippy_lints/src/mem_forget.rs index e3299958ae68..55654a7de43b 100644 --- a/clippy_lints/src/mem_forget.rs +++ b/clippy_lints/src/mem_forget.rs @@ -27,8 +27,8 @@ impl LintPass for MemForget { } } -impl LateLintPass for MemForget { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MemForget { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { if let ExprCall(ref path_expr, ref args) = e.node { if let ExprPath(ref qpath) = path_expr.node { let def_id = cx.tcx.tables().qpath_def(qpath, path_expr.id).def_id(); diff --git a/clippy_lints/src/methods.rs b/clippy_lints/src/methods.rs index dd99f5a358ba..cb8fd62961d8 100644 --- a/clippy_lints/src/methods.rs +++ b/clippy_lints/src/methods.rs @@ -549,11 +549,11 @@ impl LintPass for Pass { } } -impl LateLintPass for Pass { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { #[allow(unused_attributes)] // ^ required because `cyclomatic_complexity` attribute shows up as unused #[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) { 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) { return; } diff --git a/clippy_lints/src/minmax.rs b/clippy_lints/src/minmax.rs index f1f353cb762c..ccfc01a00030 100644 --- a/clippy_lints/src/minmax.rs +++ b/clippy_lints/src/minmax.rs @@ -33,8 +33,8 @@ impl LintPass for MinMaxPass { } } -impl LateLintPass for MinMaxPass { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MinMaxPass { + 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((inner_max, inner_c, _)) = min_max(cx, oe) { if outer_max == inner_max { diff --git a/clippy_lints/src/misc.rs b/clippy_lints/src/misc.rs index 679bad666b9f..0680f6b41a16 100644 --- a/clippy_lints/src/misc.rs +++ b/clippy_lints/src/misc.rs @@ -166,8 +166,8 @@ impl LintPass for Pass { } } -impl LateLintPass for Pass { - fn check_fn<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, k: FnKind<'tcx>, decl: &'tcx FnDecl, _: &'tcx Expr, _: Span, _: NodeId) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { + fn check_fn(&mut self, cx: &LateContext<'a, 'tcx>, k: FnKind<'tcx>, decl: &'tcx FnDecl, _: &'tcx Expr, _: Span, _: NodeId) { if let FnKind::Closure(_) = k { // Does not apply to closures 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! {[ let StmtDecl(ref d, _) = s.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 { let op = cmp.node; 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 right.node == PatKind::Wild { span_lint(cx, diff --git a/clippy_lints/src/missing_doc.rs b/clippy_lints/src/missing_doc.rs index e40638616b6e..2f3bdeb053c8 100644 --- a/clippy_lints/src/missing_doc.rs +++ b/clippy_lints/src/missing_doc.rs @@ -94,8 +94,8 @@ impl LintPass for MissingDoc { } } -impl LateLintPass for MissingDoc { - fn enter_lint_attrs<'a, 'tcx: 'a>(&mut self, _: &LateContext<'a, 'tcx>, attrs: &'tcx [ast::Attribute]) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc { + fn enter_lint_attrs(&mut self, _: &LateContext<'a, 'tcx>, attrs: &'tcx [ast::Attribute]) { let doc_hidden = self.doc_hidden() || attrs.iter().any(|attr| { attr.check_name("doc") && match attr.meta_item_list() { None => false, @@ -105,15 +105,15 @@ impl LateLintPass for MissingDoc { 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"); } - 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"); } - 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 { hir::ItemConst(..) => "a constant", hir::ItemEnum(..) => "an enum", @@ -134,7 +134,7 @@ impl LateLintPass for MissingDoc { 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 { hir::ConstTraitItem(..) => "an associated constant", 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); } - 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. let def_id = cx.tcx.map.local_def_id(impl_item.id); 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); } - 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() { 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"); } } diff --git a/clippy_lints/src/mut_mut.rs b/clippy_lints/src/mut_mut.rs index 303c53186024..40bb77871dbc 100644 --- a/clippy_lints/src/mut_mut.rs +++ b/clippy_lints/src/mut_mut.rs @@ -31,12 +31,12 @@ impl LintPass for MutMut { } } -impl LateLintPass for MutMut { - fn check_block<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, block: &'tcx hir::Block) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MutMut { + fn check_block(&mut self, cx: &LateContext<'a, 'tcx>, block: &'tcx hir::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; MutVisitor { cx: cx }.visit_ty(ty); diff --git a/clippy_lints/src/mut_reference.rs b/clippy_lints/src/mut_reference.rs index 08d39b7c43d6..c189ecba6de7 100644 --- a/clippy_lints/src/mut_reference.rs +++ b/clippy_lints/src/mut_reference.rs @@ -32,8 +32,8 @@ impl LintPass for UnnecessaryMutPassed { } } -impl LateLintPass for UnnecessaryMutPassed { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnnecessaryMutPassed { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { let borrowed_table = cx.tcx.tables.borrow(); match e.node { ExprCall(ref fn_expr, ref arguments) => { diff --git a/clippy_lints/src/mutex_atomic.rs b/clippy_lints/src/mutex_atomic.rs index 71fcda814a3b..8d927110b9d2 100644 --- a/clippy_lints/src/mutex_atomic.rs +++ b/clippy_lints/src/mutex_atomic.rs @@ -54,8 +54,8 @@ impl LintPass for MutexAtomic { pub struct MutexAtomic; -impl LateLintPass for MutexAtomic { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MutexAtomic { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { let ty = cx.tcx.tables().expr_ty(expr); if let ty::TyAdt(_, subst) = ty.sty { if match_type(cx, ty, &paths::MUTEX) { diff --git a/clippy_lints/src/needless_bool.rs b/clippy_lints/src/needless_bool.rs index bfa51f0ba703..3b08ebdbc8e0 100644 --- a/clippy_lints/src/needless_bool.rs +++ b/clippy_lints/src/needless_bool.rs @@ -56,8 +56,8 @@ impl LintPass for NeedlessBool { } } -impl LateLintPass for NeedlessBool { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessBool { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { use self::Expression::*; if let ExprIf(ref pred, ref then_block, Some(ref else_expr)) = e.node { let reduce = |ret, not| { @@ -116,8 +116,8 @@ impl LintPass for BoolComparison { } } -impl LateLintPass for BoolComparison { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BoolComparison { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { use self::Expression::*; 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)) { diff --git a/clippy_lints/src/needless_borrow.rs b/clippy_lints/src/needless_borrow.rs index 0f03ff774d2b..935e0da8c3ed 100644 --- a/clippy_lints/src/needless_borrow.rs +++ b/clippy_lints/src/needless_borrow.rs @@ -34,8 +34,8 @@ impl LintPass for NeedlessBorrow { } } -impl LateLintPass for NeedlessBorrow { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessBorrow { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { if in_macro(cx, e.span) { 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) { return; } diff --git a/clippy_lints/src/needless_update.rs b/clippy_lints/src/needless_update.rs index 82cd502081f7..de6277aa0ee5 100644 --- a/clippy_lints/src/needless_update.rs +++ b/clippy_lints/src/needless_update.rs @@ -30,8 +30,8 @@ impl LintPass for Pass { } } -impl LateLintPass for Pass { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { if let ExprStruct(_, ref fields, Some(ref base)) = expr.node { let ty = cx.tcx.tables().expr_ty(expr); if let TyAdt(def, _) = ty.sty { diff --git a/clippy_lints/src/neg_multiply.rs b/clippy_lints/src/neg_multiply.rs index 6b0c8001ed22..05a6a92c9e9d 100644 --- a/clippy_lints/src/neg_multiply.rs +++ b/clippy_lints/src/neg_multiply.rs @@ -31,8 +31,8 @@ impl LintPass for NegMultiply { } #[allow(match_same_arms)] -impl LateLintPass for NegMultiply { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NegMultiply { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { if let ExprBinary(Spanned { node: BiMul, .. }, ref l, ref r) = e.node { match (&l.node, &r.node) { (&ExprUnary(..), &ExprUnary(..)) => (), diff --git a/clippy_lints/src/new_without_default.rs b/clippy_lints/src/new_without_default.rs index 836a5393a9d7..f4a7ebee590f 100644 --- a/clippy_lints/src/new_without_default.rs +++ b/clippy_lints/src/new_without_default.rs @@ -89,8 +89,8 @@ impl LintPass for NewWithoutDefault { } } -impl LateLintPass for NewWithoutDefault { - fn check_fn<'a, 'tcx: 'a>( +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault { + fn check_fn( &mut self, cx: &LateContext<'a, 'tcx>, kind: FnKind<'tcx>, diff --git a/clippy_lints/src/no_effect.rs b/clippy_lints/src/no_effect.rs index 0a5c21114fb5..4a4b73b697f8 100644 --- a/clippy_lints/src/no_effect.rs +++ b/clippy_lints/src/no_effect.rs @@ -102,8 +102,8 @@ impl LintPass for Pass { } } -impl LateLintPass for Pass { - fn check_stmt<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, stmt: &'tcx Stmt) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { + fn check_stmt(&mut self, cx: &LateContext<'a, 'tcx>, stmt: &'tcx Stmt) { if let StmtSemi(ref expr, _) = stmt.node { if has_no_effect(cx, expr) { span_lint(cx, NO_EFFECT, stmt.span, "statement with no effect"); diff --git a/clippy_lints/src/ok_if_let.rs b/clippy_lints/src/ok_if_let.rs index 77244acb3081..6ac49c1f575d 100644 --- a/clippy_lints/src/ok_if_let.rs +++ b/clippy_lints/src/ok_if_let.rs @@ -40,8 +40,8 @@ impl LintPass for Pass { } } -impl LateLintPass for Pass { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { if_let_chain! {[ //begin checking variables 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 diff --git a/clippy_lints/src/open_options.rs b/clippy_lints/src/open_options.rs index 538d09d082ee..f102bdcab33d 100644 --- a/clippy_lints/src/open_options.rs +++ b/clippy_lints/src/open_options.rs @@ -32,8 +32,8 @@ impl LintPass for NonSensical { } } -impl LateLintPass for NonSensical { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSensical { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { if let ExprMethodCall(ref name, _, ref arguments) = e.node { 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) { diff --git a/clippy_lints/src/overflow_check_conditional.rs b/clippy_lints/src/overflow_check_conditional.rs index 583b9315fee8..a09ff3bebf68 100644 --- a/clippy_lints/src/overflow_check_conditional.rs +++ b/clippy_lints/src/overflow_check_conditional.rs @@ -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 - 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! {[ let Expr_::ExprBinary(ref op, ref first, ref second) = expr.node, let Expr_::ExprBinary(ref op2, ref ident1, ref ident2) = first.node, diff --git a/clippy_lints/src/panic.rs b/clippy_lints/src/panic.rs index 893a17a63fc7..3b4fbb3ab1b6 100644 --- a/clippy_lints/src/panic.rs +++ b/clippy_lints/src/panic.rs @@ -32,8 +32,8 @@ impl LintPass for Pass { } } -impl LateLintPass for Pass { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { if_let_chain! {[ let ExprBlock(ref block) = expr.node, let Some(ref ex) = block.expr, diff --git a/clippy_lints/src/partialeq_ne_impl.rs b/clippy_lints/src/partialeq_ne_impl.rs index 4982055ef3a2..2677b40f757a 100644 --- a/clippy_lints/src/partialeq_ne_impl.rs +++ b/clippy_lints/src/partialeq_ne_impl.rs @@ -35,8 +35,8 @@ impl LintPass for Pass { } } -impl LateLintPass for Pass { - fn check_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { + fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { if_let_chain! {[ let ItemImpl(_, _, _, Some(ref trait_ref), _, ref impl_items) = item.node, !is_automatically_derived(&*item.attrs), diff --git a/clippy_lints/src/print.rs b/clippy_lints/src/print.rs index be70f6a7648f..daa55c9675fc 100644 --- a/clippy_lints/src/print.rs +++ b/clippy_lints/src/print.rs @@ -65,8 +65,8 @@ impl LintPass for Pass { } } -impl LateLintPass for Pass { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { if_let_chain! {[ let ExprCall(ref fun, ref args) = expr.node, let ExprPath(ref qpath) = fun.node, diff --git a/clippy_lints/src/ptr.rs b/clippy_lints/src/ptr.rs index a6be3fae45fc..f1fdc78aca4a 100644 --- a/clippy_lints/src/ptr.rs +++ b/clippy_lints/src/ptr.rs @@ -54,14 +54,14 @@ impl LintPass for PointerPass { } } -impl LateLintPass for PointerPass { - fn check_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PointerPass { + fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { if let ItemFn(ref decl, _, _, _, _, _) = item.node { 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 Some(NodeItem(it)) = cx.tcx.map.find(cx.tcx.map.get_parent(item.id)) { 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 { 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 (op.node == BiEq || op.node == BiNe) && (is_null_path(l) || is_null_path(r)) { span_lint(cx, diff --git a/clippy_lints/src/ranges.rs b/clippy_lints/src/ranges.rs index 6936fc199934..78f097002039 100644 --- a/clippy_lints/src/ranges.rs +++ b/clippy_lints/src/ranges.rs @@ -46,8 +46,8 @@ impl LintPass for StepByZero { } } -impl LateLintPass for StepByZero { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for StepByZero { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { if let ExprMethodCall(Spanned { node: ref name, .. }, _, ref args) = expr.node { let name = &*name.as_str(); diff --git a/clippy_lints/src/regex.rs b/clippy_lints/src/regex.rs index d04b03fcf57e..6e6b6156d6e6 100644 --- a/clippy_lints/src/regex.rs +++ b/clippy_lints/src/regex.rs @@ -82,12 +82,12 @@ impl LintPass for Pass { } } -impl LateLintPass for Pass { - fn check_crate<'a, 'tcx: 'a>(&mut self, _: &LateContext<'a, 'tcx>, _: &'tcx Crate) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { + fn check_crate(&mut self, _: &LateContext<'a, 'tcx>, _: &'tcx Crate) { 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!{[ self.last.is_none(), 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) { 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!{[ let ExprCall(ref fun, ref args) = expr.node, let ExprPath(ref qpath) = fun.node, diff --git a/clippy_lints/src/serde.rs b/clippy_lints/src/serde.rs index 97a0e0052b58..ec4bce557061 100644 --- a/clippy_lints/src/serde.rs +++ b/clippy_lints/src/serde.rs @@ -26,8 +26,8 @@ impl LintPass for Serde { } } -impl LateLintPass for Serde { - fn check_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Serde { + fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { if let ItemImpl(_, _, _, Some(ref trait_ref), _, ref items) = item.node { let did = trait_ref.path.def.def_id(); if let Some(visit_did) = get_trait_def_id(cx, &paths::SERDE_DE_VISITOR) { diff --git a/clippy_lints/src/shadow.rs b/clippy_lints/src/shadow.rs index 9ec4ceba7e67..2d32a8792741 100644 --- a/clippy_lints/src/shadow.rs +++ b/clippy_lints/src/shadow.rs @@ -79,8 +79,8 @@ impl LintPass for Pass { } } -impl LateLintPass for Pass { - fn check_fn<'a, 'tcx: 'a>( +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { + fn check_fn( &mut self, cx: &LateContext<'a, '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(); for arg in &decl.inputs { 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); } -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(); for stmt in &block.stmts { match stmt.node { @@ -121,7 +121,7 @@ fn check_block<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, block: &'tcx Block, bin 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) { 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>, pat: &'tcx Pat, 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) { 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 { TyObjectSum(ref sty, _) | TySlice(ref sty) => check_ty(cx, sty, bindings), diff --git a/clippy_lints/src/strings.rs b/clippy_lints/src/strings.rs index 985ef912dc1c..01f2f66c2fde 100644 --- a/clippy_lints/src/strings.rs +++ b/clippy_lints/src/strings.rs @@ -79,8 +79,8 @@ impl LintPass for StringAdd { } } -impl LateLintPass for StringAdd { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for StringAdd { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { if let ExprBinary(Spanned { node: BiAdd, .. }, ref left, _) = e.node { if is_string(cx, left) { if let Allow = cx.current_level(STRING_ADD_ASSIGN) { @@ -136,8 +136,8 @@ impl LintPass for StringLitAsBytes { } } -impl LateLintPass for StringLitAsBytes { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for StringLitAsBytes { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { use std::ascii::AsciiExt; use syntax::ast::LitKind; use utils::{snippet, in_macro}; diff --git a/clippy_lints/src/swap.rs b/clippy_lints/src/swap.rs index f251db2b1870..7393ee3890e5 100644 --- a/clippy_lints/src/swap.rs +++ b/clippy_lints/src/swap.rs @@ -50,8 +50,8 @@ impl LintPass for Swap { } } -impl LateLintPass for Swap { - fn check_block<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, block: &'tcx Block) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Swap { + fn check_block(&mut self, cx: &LateContext<'a, 'tcx>, block: &'tcx Block) { check_manual_swap(cx, block); check_suspicious_swap(cx, block); } diff --git a/clippy_lints/src/temporary_assignment.rs b/clippy_lints/src/temporary_assignment.rs index c6246fec9b0f..2f6e6d97fbf7 100644 --- a/clippy_lints/src/temporary_assignment.rs +++ b/clippy_lints/src/temporary_assignment.rs @@ -37,8 +37,8 @@ impl LintPass for Pass { } } -impl LateLintPass for Pass { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { if let ExprAssign(ref target, _) = expr.node { match target.node { ExprField(ref base, _) | diff --git a/clippy_lints/src/transmute.rs b/clippy_lints/src/transmute.rs index 2d09c725fb0d..b6731db93839 100644 --- a/clippy_lints/src/transmute.rs +++ b/clippy_lints/src/transmute.rs @@ -84,8 +84,8 @@ impl LintPass for Transmute { } } -impl LateLintPass for Transmute { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Transmute { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { if let ExprCall(ref path_expr, ref args) = e.node { if let ExprPath(ref qpath) = path_expr.node { let def_id = cx.tcx.tables().qpath_def(qpath, path_expr.id).def_id(); diff --git a/clippy_lints/src/types.rs b/clippy_lints/src/types.rs index 66c14e70e6a5..d2bc850e2078 100644 --- a/clippy_lints/src/types.rs +++ b/clippy_lints/src/types.rs @@ -69,8 +69,8 @@ impl LintPass for TypePass { } } -impl LateLintPass for TypePass { - fn check_ty<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, ast_ty: &'tcx Ty) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypePass { + fn check_ty(&mut self, cx: &LateContext<'a, 'tcx>, ast_ty: &'tcx Ty) { if in_macro(cx, ast_ty.span) { return; } @@ -153,8 +153,8 @@ impl LintPass for LetPass { } } -impl LateLintPass for LetPass { - fn check_decl<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, decl: &'tcx Decl) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LetPass { + fn check_decl(&mut self, cx: &LateContext<'a, 'tcx>, decl: &'tcx Decl) { check_let_unit(cx, decl) } } @@ -190,8 +190,8 @@ impl LintPass for UnitCmp { } } -impl LateLintPass for UnitCmp { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnitCmp { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { if in_macro(cx, expr.span) { return; } @@ -447,8 +447,8 @@ impl LintPass for CastPass { } } -impl LateLintPass for CastPass { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CastPass { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { if let ExprCast(ref ex, _) = expr.node { 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) { @@ -535,17 +535,17 @@ impl LintPass for TypeComplexityPass { } } -impl LateLintPass for TypeComplexityPass { - fn check_fn<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, _: FnKind<'tcx>, decl: &'tcx FnDecl, _: &'tcx Expr, _: Span, _: NodeId) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeComplexityPass { + fn check_fn(&mut self, cx: &LateContext<'a, 'tcx>, _: FnKind<'tcx>, decl: &'tcx FnDecl, _: &'tcx Expr, _: Span, _: NodeId) { 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 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 { ItemStatic(ref 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 { ConstTraitItem(ref 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 { ImplItemKind::Const(ref 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 { self.check_type(cx, ty); } } } -impl TypeComplexityPass { - fn check_fndecl<'a, 'tcx: 'a>(&self, cx: &LateContext<'a, 'tcx>, decl: &'tcx FnDecl) { +impl<'a, 'tcx> TypeComplexityPass { + fn check_fndecl(&self, cx: &LateContext<'a, 'tcx>, decl: &'tcx FnDecl) { for arg in &decl.inputs { 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) { return; } @@ -682,8 +682,8 @@ impl LintPass for CharLitAsU8 { } } -impl LateLintPass for CharLitAsU8 { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CharLitAsU8 { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { use syntax::ast::{LitKind, UintTy}; if let ExprCast(ref e, _) = expr.node { @@ -846,8 +846,8 @@ fn detect_extreme_expr<'a>(cx: &LateContext, expr: &'a Expr) -> Option(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AbsurdExtremeComparisons { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { use types::ExtremeType::*; use types::AbsurdComparisonResult::*; @@ -1071,8 +1071,8 @@ fn upcast_comparison_bounds_err(cx: &LateContext, span: &Span, rel: comparisons: } } -impl LateLintPass for InvalidUpcastComparisons { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidUpcastComparisons { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { if let ExprBinary(ref cmp, ref lhs, ref rhs) = expr.node { let normalized = comparisons::normalize_comparison(cmp.node, lhs, rhs); diff --git a/clippy_lints/src/unicode.rs b/clippy_lints/src/unicode.rs index ba82bc470dca..1d5ab7db3461 100644 --- a/clippy_lints/src/unicode.rs +++ b/clippy_lints/src/unicode.rs @@ -68,8 +68,8 @@ impl LintPass for Unicode { } } -impl LateLintPass for Unicode { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Unicode { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { if let ExprLit(ref lit) = expr.node { if let LitKind::Str(_, _) = lit.node { check_str(cx, lit.span) diff --git a/clippy_lints/src/unused_label.rs b/clippy_lints/src/unused_label.rs index 8119c4d727ab..4f1e01af6e9f 100644 --- a/clippy_lints/src/unused_label.rs +++ b/clippy_lints/src/unused_label.rs @@ -40,8 +40,8 @@ impl LintPass for UnusedLabel { } } -impl LateLintPass for UnusedLabel { - fn check_fn<'a, 'tcx: 'a>( +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedLabel { + fn check_fn( &mut self, cx: &LateContext<'a, 'tcx>, kind: FnKind<'tcx>, diff --git a/clippy_lints/src/utils/inspector.rs b/clippy_lints/src/utils/inspector.rs index ef98247b7e83..b2900c5691c7 100644 --- a/clippy_lints/src/utils/inspector.rs +++ b/clippy_lints/src/utils/inspector.rs @@ -36,15 +36,15 @@ impl LintPass for Pass { } } -impl LateLintPass for Pass { - fn check_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { + fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item) { if !has_attr(&item.attrs) { return; } 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) { 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) { 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) { 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) { 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) { return; } 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) { return; } @@ -109,7 +109,7 @@ impl LateLintPass for Pass { 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()) { 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) { return; } diff --git a/clippy_lints/src/utils/internal_lints.rs b/clippy_lints/src/utils/internal_lints.rs index c2e55862b3db..91961f906919 100644 --- a/clippy_lints/src/utils/internal_lints.rs +++ b/clippy_lints/src/utils/internal_lints.rs @@ -104,8 +104,8 @@ impl LintPass for LintWithoutLintPass { } -impl LateLintPass for LintWithoutLintPass { - fn check_item<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LintWithoutLintPass { + fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { if let ItemStatic(ref ty, MutImmutable, ref expr) = item.node { if is_lint_ref_type(ty) { 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 { // When using the `declare_lint!` macro, the original `lint_span`'s // file points to "". diff --git a/clippy_lints/src/vec.rs b/clippy_lints/src/vec.rs index bed98559e6f0..1cfb57496f7a 100644 --- a/clippy_lints/src/vec.rs +++ b/clippy_lints/src/vec.rs @@ -32,8 +32,8 @@ impl LintPass for Pass { } } -impl LateLintPass for Pass { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { // search for `&vec![_]` expressions where the adjusted type is `&[_]` if_let_chain!{[ let ty::TypeVariants::TyRef(_, ref ty) = cx.tcx.tables().expr_ty_adjusted(expr).sty, diff --git a/clippy_lints/src/zero_div_zero.rs b/clippy_lints/src/zero_div_zero.rs index b0cc96f3d64b..daf0721af05a 100644 --- a/clippy_lints/src/zero_div_zero.rs +++ b/clippy_lints/src/zero_div_zero.rs @@ -27,8 +27,8 @@ impl LintPass for Pass { } } -impl LateLintPass for Pass { - fn check_expr<'a, 'tcx: 'a>(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { + fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { // check for instances of 0.0/0.0 if_let_chain! {[ let ExprBinary(ref op, ref left, ref right) = expr.node,