]> git.lizzy.rs Git - rust.git/commitdiff
Fix warnings about unnecessary lifetime bounds
authorLzu Tao <taolzu@gmail.com>
Wed, 19 Jun 2019 18:36:23 +0000 (01:36 +0700)
committerLzu Tao <taolzu@gmail.com>
Wed, 19 Jun 2019 18:36:23 +0000 (01:36 +0700)
Rustup https://github.com/rust-lang/rust/pull/61172

34 files changed:
clippy_lints/src/assign_ops.rs
clippy_lints/src/block_in_if_condition.rs
clippy_lints/src/booleans.rs
clippy_lints/src/cognitive_complexity.rs
clippy_lints/src/consts.rs
clippy_lints/src/entry.rs
clippy_lints/src/escape.rs
clippy_lints/src/eval_order_dependence.rs
clippy_lints/src/fallible_impl_from.rs
clippy_lints/src/functions.rs
clippy_lints/src/let_if_seq.rs
clippy_lints/src/lifetimes.rs
clippy_lints/src/loops.rs
clippy_lints/src/matches.rs
clippy_lints/src/methods/mod.rs
clippy_lints/src/methods/option_map_unwrap_or.rs
clippy_lints/src/methods/unnecessary_filter_map.rs
clippy_lints/src/mut_mut.rs
clippy_lints/src/needless_pass_by_value.rs
clippy_lints/src/non_expressive_names.rs
clippy_lints/src/shadow.rs
clippy_lints/src/slow_vector_initialization.rs
clippy_lints/src/suspicious_trait_impl.rs
clippy_lints/src/types.rs
clippy_lints/src/unused_label.rs
clippy_lints/src/unwrap.rs
clippy_lints/src/use_self.rs
clippy_lints/src/utils/hir_utils.rs
clippy_lints/src/utils/internal_lints.rs
clippy_lints/src/utils/mod.rs
clippy_lints/src/utils/ptr.rs
clippy_lints/src/utils/usage.rs
tests/ui/new_without_default.rs
tests/ui/transmute.rs

index 2056a4af0d5367b129462e89740ed2fad5bb660e..28a5f8246f77b1574ba935e42bc8e810052ff32e 100644 (file)
@@ -236,13 +236,13 @@ fn is_commutative(op: hir::BinOpKind) -> bool {
     }
 }
 
-struct ExprVisitor<'a, 'tcx: 'a> {
+struct ExprVisitor<'a, 'tcx> {
     assignee: &'a hir::Expr,
     counter: u8,
     cx: &'a LateContext<'a, 'tcx>,
 }
 
-impl<'a, 'tcx: 'a> Visitor<'tcx> for ExprVisitor<'a, 'tcx> {
+impl<'a, 'tcx> Visitor<'tcx> for ExprVisitor<'a, 'tcx> {
     fn visit_expr(&mut self, expr: &'tcx hir::Expr) {
         if SpanlessEq::new(self.cx).ignore_fn().eq_expr(self.assignee, expr) {
             self.counter += 1;
index 786cba9fc7d82640d0d9bfab60faaa1446cbde03..4fd9e271af084d734e74d6e11566b84dd3951d75 100644 (file)
 
 declare_lint_pass!(BlockInIfCondition => [BLOCK_IN_IF_CONDITION_EXPR, BLOCK_IN_IF_CONDITION_STMT]);
 
-struct ExVisitor<'a, 'tcx: 'a> {
+struct ExVisitor<'a, 'tcx> {
     found_block: Option<&'tcx Expr>,
     cx: &'a LateContext<'a, 'tcx>,
 }
 
-impl<'a, 'tcx: 'a> Visitor<'tcx> for ExVisitor<'a, 'tcx> {
+impl<'a, 'tcx> Visitor<'tcx> for ExVisitor<'a, 'tcx> {
     fn visit_expr(&mut self, expr: &'tcx Expr) {
         if let ExprKind::Closure(_, _, eid, _, _) = expr.node {
             let body = self.cx.tcx.hir().body(eid);
index 57390f84c820b5dc172634a3bddd538e1afdd0db..0acf620cd17e823b7f002181a983e92b3a59ec53 100644 (file)
@@ -68,12 +68,12 @@ fn check_fn(
     }
 }
 
-struct NonminimalBoolVisitor<'a, 'tcx: 'a> {
+struct NonminimalBoolVisitor<'a, 'tcx> {
     cx: &'a LateContext<'a, 'tcx>,
 }
 
 use quine_mc_cluskey::Bool;
-struct Hir2Qmm<'a, 'tcx: 'a, 'v> {
+struct Hir2Qmm<'a, 'tcx, 'v> {
     terminals: Vec<&'v Expr>,
     cx: &'a LateContext<'a, 'tcx>,
 }
@@ -155,7 +155,7 @@ fn run(&mut self, e: &'v Expr) -> Result<Bool, String> {
     }
 }
 
-struct SuggestContext<'a, 'tcx: 'a, 'v> {
+struct SuggestContext<'a, 'tcx, 'v> {
     terminals: &'v [&'v Expr],
     cx: &'a LateContext<'a, 'tcx>,
     output: String,
index f01322768fa007ebab4736957422c5ec5d6f6592..ea644450f6f4116f51b57c5acc5efef99ad071b3 100644 (file)
@@ -41,7 +41,7 @@ pub fn new(limit: u64) -> Self {
 impl_lint_pass!(CognitiveComplexity => [COGNITIVE_COMPLEXITY]);
 
 impl CognitiveComplexity {
-    fn check<'a, 'tcx: 'a>(&mut self, cx: &'a LateContext<'a, 'tcx>, body: &'tcx Body, span: Span) {
+    fn check<'a, 'tcx>(&mut self, cx: &'a LateContext<'a, 'tcx>, body: &'tcx Body, span: Span) {
         if in_macro_or_desugar(span) {
             return;
         }
@@ -132,7 +132,7 @@ fn exit_lint_attrs(&mut self, cx: &LateContext<'a, 'tcx>, attrs: &'tcx [Attribut
     }
 }
 
-struct CCHelper<'a, 'tcx: 'a> {
+struct CCHelper<'a, 'tcx> {
     match_arms: u64,
     divergence: u64,
     returns: u64,
index e5b47a0c29e7a1b001b4ef11aa8f24c0a54a2202..480118ca7ea412b21681644a1318140ee61acb33 100644 (file)
@@ -210,7 +210,7 @@ pub fn constant_context<'c, 'cc>(
     }
 }
 
-pub struct ConstEvalLateContext<'a, 'tcx: 'a> {
+pub struct ConstEvalLateContext<'a, 'tcx> {
     lcx: &'a LateContext<'a, 'tcx>,
     tables: &'a ty::TypeckTables<'tcx>,
     param_env: ty::ParamEnv<'tcx>,
index 43930842387a4f9e56d995eba23f62133d3c9bd1..83f78b2d72d60ba2613da75b2607b7fc087a2aa8 100644 (file)
@@ -112,7 +112,7 @@ fn check_cond<'a, 'tcx, 'b>(
     None
 }
 
-struct InsertVisitor<'a, 'tcx: 'a, 'b> {
+struct InsertVisitor<'a, 'tcx, 'b> {
     cx: &'a LateContext<'a, 'tcx>,
     span: Span,
     ty: &'static str,
index 9106c15579634acb28ed5599efda1a214909582a..bbc3084c157291acc0a1ecce0f0a226854d96cb6 100644 (file)
@@ -43,7 +43,7 @@ fn is_non_trait_box(ty: Ty<'_>) -> bool {
     ty.is_box() && !ty.boxed_ty().is_trait()
 }
 
-struct EscapeDelegate<'a, 'tcx: 'a> {
+struct EscapeDelegate<'a, 'tcx> {
     cx: &'a LateContext<'a, 'tcx>,
     set: HirIdSet,
     too_large_for_stack: u64,
index dc98158c50991dc2a45297fe1fd578a3028e3b99..00143896951614470eddfbbd4b554952145828e9 100644 (file)
@@ -92,7 +92,7 @@ fn check_stmt(&mut self, cx: &LateContext<'a, 'tcx>, stmt: &'tcx Stmt) {
     }
 }
 
-struct DivergenceVisitor<'a, 'tcx: 'a> {
+struct DivergenceVisitor<'a, 'tcx> {
     cx: &'a LateContext<'a, 'tcx>,
 }
 
@@ -272,7 +272,7 @@ fn check_stmt<'a, 'tcx>(vis: &mut ReadVisitor<'a, 'tcx>, stmt: &'tcx Stmt) -> St
 }
 
 /// A visitor that looks for reads from a variable.
-struct ReadVisitor<'a, 'tcx: 'a> {
+struct ReadVisitor<'a, 'tcx> {
     cx: &'a LateContext<'a, 'tcx>,
     /// The ID of the variable we're looking for.
     var: HirId,
index 3aac7bfc69ec9b80b680ea38f05728de388ce58a..1d2de8978fb6068088ab17cb51dab1726ee9d138 100644 (file)
@@ -49,13 +49,13 @@ fn lint_impl_body<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, impl_span: Span, impl_it
     use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
     use rustc::hir::*;
 
-    struct FindPanicUnwrap<'a, 'tcx: 'a> {
+    struct FindPanicUnwrap<'a, 'tcx> {
         lcx: &'a LateContext<'a, 'tcx>,
         tables: &'tcx ty::TypeckTables<'tcx>,
         result: Vec<Span>,
     }
 
-    impl<'a, 'tcx: 'a> Visitor<'tcx> for FindPanicUnwrap<'a, 'tcx> {
+    impl<'a, 'tcx> Visitor<'tcx> for FindPanicUnwrap<'a, 'tcx> {
         fn visit_expr(&mut self, expr: &'tcx Expr) {
             // check for `begin_panic`
             if_chain! {
index 1f69b67de7b2df6560b517f45d76614404d5c548..aeb9b0c42d71fa1067f544063d2ae54c637addc6 100644 (file)
@@ -291,7 +291,7 @@ fn raw_ptr_arg(arg: &hir::Arg, ty: &hir::Ty) -> Option<hir::HirId> {
     }
 }
 
-struct DerefVisitor<'a, 'tcx: 'a> {
+struct DerefVisitor<'a, 'tcx> {
     cx: &'a LateContext<'a, 'tcx>,
     ptrs: FxHashSet<hir::HirId>,
     tables: &'a ty::TypeckTables<'tcx>,
@@ -330,7 +330,7 @@ fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'thi
     }
 }
 
-impl<'a, 'tcx: 'a> DerefVisitor<'a, 'tcx> {
+impl<'a, 'tcx> DerefVisitor<'a, 'tcx> {
     fn check_arg(&self, ptr: &hir::Expr) {
         if let hir::ExprKind::Path(ref qpath) = ptr.node {
             if let Res::Local(id) = self.cx.tables.qpath_res(qpath, ptr.hir_id) {
index 990d8facd13473137606b8858aedad4b1a31cbb4..845e40c5edf083b79477e4f48053a93c9c6bdbba 100644 (file)
@@ -135,7 +135,7 @@ fn check_block(&mut self, cx: &LateContext<'a, 'tcx>, block: &'tcx hir::Block) {
     }
 }
 
-struct UsedVisitor<'a, 'tcx: 'a> {
+struct UsedVisitor<'a, 'tcx> {
     cx: &'a LateContext<'a, 'tcx>,
     id: hir::HirId,
     used: bool,
@@ -194,7 +194,7 @@ fn check_assign<'a, 'tcx>(
     None
 }
 
-fn used_in_expr<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, id: hir::HirId, expr: &'tcx hir::Expr) -> bool {
+fn used_in_expr<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, id: hir::HirId, expr: &'tcx hir::Expr) -> bool {
     let mut v = UsedVisitor { cx, id, used: false };
     hir::intravisit::walk_expr(&mut v, expr);
     v.used
index c3446b1ed7aed525971e9cbbc919c82bcbac26db..dbdb3c51962759d2c0aa5a4b0165f2c9c34b3327 100644 (file)
@@ -147,7 +147,7 @@ fn check_fn_inner<'a, 'tcx>(
     report_extra_lifetimes(cx, decl, generics);
 }
 
-fn could_use_elision<'a, 'tcx: 'a>(
+fn could_use_elision<'a, 'tcx>(
     cx: &LateContext<'a, 'tcx>,
     func: &'tcx FnDecl,
     body: Option<BodyId>,
@@ -264,7 +264,7 @@ fn unique_lifetimes(lts: &[RefLt]) -> usize {
 }
 
 /// A visitor usable for `rustc_front::visit::walk_ty()`.
-struct RefVisitor<'a, 'tcx: 'a> {
+struct RefVisitor<'a, 'tcx> {
     cx: &'a LateContext<'a, 'tcx>,
     lts: Vec<RefLt>,
     abort: bool,
@@ -377,7 +377,7 @@ fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
 
 /// Are any lifetimes mentioned in the `where` clause? If so, we don't try to
 /// reason about elision.
-fn has_where_lifetimes<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, where_clause: &'tcx WhereClause) -> bool {
+fn has_where_lifetimes<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, where_clause: &'tcx WhereClause) -> bool {
     for predicate in &where_clause.predicates {
         match *predicate {
             WherePredicate::RegionPredicate(..) => return true,
@@ -445,7 +445,7 @@ fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
     }
 }
 
-fn report_extra_lifetimes<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, func: &'tcx FnDecl, generics: &'tcx Generics) {
+fn report_extra_lifetimes<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, func: &'tcx FnDecl, generics: &'tcx Generics) {
     let hs = generics
         .params
         .iter()
index 882f9a1af1bc300e0deaceaa021205a213c878ad..b4d2e921e05098ba3cee7aaf47e8855cfc36b09f 100644 (file)
@@ -1723,13 +1723,13 @@ fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
     }
 }
 
-struct LocalUsedVisitor<'a, 'tcx: 'a> {
+struct LocalUsedVisitor<'a, 'tcx> {
     cx: &'a LateContext<'a, 'tcx>,
     local: HirId,
     used: bool,
 }
 
-impl<'a, 'tcx: 'a> Visitor<'tcx> for LocalUsedVisitor<'a, 'tcx> {
+impl<'a, 'tcx> Visitor<'tcx> for LocalUsedVisitor<'a, 'tcx> {
     fn visit_expr(&mut self, expr: &'tcx Expr) {
         if same_var(self.cx, expr, self.local) {
             self.used = true;
@@ -1743,7 +1743,7 @@ fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
     }
 }
 
-struct VarVisitor<'a, 'tcx: 'a> {
+struct VarVisitor<'a, 'tcx> {
     /// context reference
     cx: &'a LateContext<'a, 'tcx>,
     /// var name to look for as index
@@ -1914,7 +1914,7 @@ fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
     }
 }
 
-fn is_used_inside<'a, 'tcx: 'a>(cx: &'a LateContext<'a, 'tcx>, expr: &'tcx Expr, container: &'tcx Expr) -> bool {
+fn is_used_inside<'a, 'tcx>(cx: &'a LateContext<'a, 'tcx>, expr: &'tcx Expr, container: &'tcx Expr) -> bool {
     let def_id = match var_def_id(cx, expr) {
         Some(id) => id,
         None => return false,
@@ -1927,7 +1927,7 @@ fn is_used_inside<'a, 'tcx: 'a>(cx: &'a LateContext<'a, 'tcx>, expr: &'tcx Expr,
     false
 }
 
-fn is_iterator_used_after_while_let<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, iter_expr: &'tcx Expr) -> bool {
+fn is_iterator_used_after_while_let<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, iter_expr: &'tcx Expr) -> bool {
     let def_id = match var_def_id(cx, iter_expr) {
         Some(id) => id,
         None => return false,
@@ -1945,7 +1945,7 @@ fn is_iterator_used_after_while_let<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, it
     visitor.var_used_after_while_let
 }
 
-struct VarUsedAfterLoopVisitor<'a, 'tcx: 'a> {
+struct VarUsedAfterLoopVisitor<'a, 'tcx> {
     cx: &'a LateContext<'a, 'tcx>,
     def_id: HirId,
     iter_expr_id: HirId,
@@ -2051,7 +2051,7 @@ enum VarState {
 }
 
 /// Scan a for loop for variables that are incremented exactly once.
-struct IncrementVisitor<'a, 'tcx: 'a> {
+struct IncrementVisitor<'a, 'tcx> {
     cx: &'a LateContext<'a, 'tcx>,      // context reference
     states: FxHashMap<HirId, VarState>, // incremented variables
     depth: u32,                         // depth of conditional expressions
@@ -2105,7 +2105,7 @@ fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
 }
 
 /// Checks whether a variable is initialized to zero at the start of a loop.
-struct InitializeVisitor<'a, 'tcx: 'a> {
+struct InitializeVisitor<'a, 'tcx> {
     cx: &'a LateContext<'a, 'tcx>, // context reference
     end_expr: &'tcx Expr,          // the for loop. Stop scanning here.
     var_id: HirId,
@@ -2374,7 +2374,7 @@ fn check_infinite_loop<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, cond: &'tcx Expr, e
 /// Stops analysis if a function call is found
 /// Note: In some cases such as `self`, there are no mutable annotation,
 /// All variables definition IDs are collected
-struct VarCollectorVisitor<'a, 'tcx: 'a> {
+struct VarCollectorVisitor<'a, 'tcx> {
     cx: &'a LateContext<'a, 'tcx>,
     ids: FxHashSet<HirId>,
     def_ids: FxHashMap<def_id::DefId, bool>,
index cb33ad4d974b8cd7a76602442744a95f66a4a23f..566082c9be05156e6939454ae2f997eabfd3f795 100644 (file)
@@ -763,7 +763,7 @@ pub fn overlapping<T>(ranges: &[SpannedRange<T>]) -> Option<(&SpannedRange<T>, &
     T: Copy + Ord,
 {
     #[derive(Copy, Clone, Debug, Eq, PartialEq)]
-    enum Kind<'a, T: 'a> {
+    enum Kind<'a, T> {
         Start(T, &'a SpannedRange<T>),
         End(Bound<T>, &'a SpannedRange<T>),
     }
index 29ea6d018ad5b26ba7b217fdc5daaf82554f55c6..1bcdbfec59003e1b9955dcc7b1cc192ab84626ad 100644 (file)
@@ -1046,7 +1046,7 @@ fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, implitem: &'tcx hir::I
 
 /// Checks for the `OR_FUN_CALL` lint.
 #[allow(clippy::too_many_lines)]
-fn lint_or_fun_call<'a, 'tcx: 'a>(
+fn lint_or_fun_call<'a, 'tcx>(
     cx: &LateContext<'a, 'tcx>,
     expr: &hir::Expr,
     method_span: Span,
@@ -1054,7 +1054,7 @@ fn lint_or_fun_call<'a, 'tcx: 'a>(
     args: &'tcx [hir::Expr],
 ) {
     // Searches an expression for method calls or function calls that aren't ctors
-    struct FunCallFinder<'a, 'tcx: 'a> {
+    struct FunCallFinder<'a, 'tcx> {
         cx: &'a LateContext<'a, 'tcx>,
         found: bool,
     }
@@ -1142,7 +1142,7 @@ fn check_unwrap_or_default(
 
     /// Checks for `*or(foo())`.
     #[allow(clippy::too_many_arguments)]
-    fn check_general_case<'a, 'tcx: 'a>(
+    fn check_general_case<'a, 'tcx>(
         cx: &LateContext<'a, 'tcx>,
         name: &str,
         method_span: Span,
index ce78c740f7c45c26d74570e50faab3b6859c58a7..769392a6fd8ff8d550282e6ff2eb6e1944e5e2dd 100644 (file)
@@ -77,12 +77,12 @@ pub(super) fn lint<'a, 'tcx>(
     }
 }
 
-struct UnwrapVisitor<'a, 'tcx: 'a> {
+struct UnwrapVisitor<'a, 'tcx> {
     cx: &'a LateContext<'a, 'tcx>,
     identifiers: FxHashSet<Symbol>,
 }
 
-impl<'a, 'tcx: 'a> Visitor<'tcx> for UnwrapVisitor<'a, 'tcx> {
+impl<'a, 'tcx> Visitor<'tcx> for UnwrapVisitor<'a, 'tcx> {
     fn visit_path(&mut self, path: &'tcx Path, _id: HirId) {
         self.identifiers.insert(ident(path));
         walk_path(self, path);
@@ -93,13 +93,13 @@ fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
     }
 }
 
-struct MapExprVisitor<'a, 'tcx: 'a> {
+struct MapExprVisitor<'a, 'tcx> {
     cx: &'a LateContext<'a, 'tcx>,
     identifiers: FxHashSet<Symbol>,
     found_identifier: bool,
 }
 
-impl<'a, 'tcx: 'a> Visitor<'tcx> for MapExprVisitor<'a, 'tcx> {
+impl<'a, 'tcx> Visitor<'tcx> for MapExprVisitor<'a, 'tcx> {
     fn visit_path(&mut self, path: &'tcx Path, _id: HirId) {
         if self.identifiers.contains(&ident(path)) {
             self.found_identifier = true;
index a28e6fa88bbe718aad0bb4d0f071653284285b78..a28e9b1e3079bb2e6d71cc5ac2acb147b1000627 100644 (file)
@@ -53,7 +53,7 @@ pub(super) fn lint(cx: &LateContext<'_, '_>, expr: &hir::Expr, args: &[hir::Expr
 }
 
 // returns (found_mapping, found_filtering)
-fn check_expression<'a, 'tcx: 'a>(
+fn check_expression<'a, 'tcx>(
     cx: &'a LateContext<'a, 'tcx>,
     arg_id: hir::HirId,
     expr: &'tcx hir::Expr,
@@ -104,7 +104,7 @@ fn check_expression<'a, 'tcx: 'a>(
     }
 }
 
-struct ReturnVisitor<'a, 'tcx: 'a> {
+struct ReturnVisitor<'a, 'tcx> {
     cx: &'a LateContext<'a, 'tcx>,
     arg_id: hir::HirId,
     // Found a non-None return that isn't Some(input)
@@ -113,7 +113,7 @@ struct ReturnVisitor<'a, 'tcx: 'a> {
     found_filtering: bool,
 }
 
-impl<'a, 'tcx: 'a> ReturnVisitor<'a, 'tcx> {
+impl<'a, 'tcx> ReturnVisitor<'a, 'tcx> {
     fn new(cx: &'a LateContext<'a, 'tcx>, arg_id: hir::HirId) -> ReturnVisitor<'a, 'tcx> {
         ReturnVisitor {
             cx,
index 3971346dd1ebe36a6b365c3bdecd062a3a05dfd0..858ad50e10439c9799b8a7855c2449716df71209 100644 (file)
@@ -37,7 +37,7 @@ fn check_ty(&mut self, cx: &LateContext<'a, 'tcx>, ty: &'tcx hir::Ty) {
     }
 }
 
-pub struct MutVisitor<'a, 'tcx: 'a> {
+pub struct MutVisitor<'a, 'tcx> {
     cx: &'a LateContext<'a, 'tcx>,
 }
 
index 424de64b5c7457aa1e96f44d731b1b6ef5a3727d..710c8975a1ef9c0e34de4ed89bfb067653d09e57 100644 (file)
@@ -326,7 +326,7 @@ fn requires_exact_signature(attrs: &[Attribute]) -> bool {
     })
 }
 
-struct MovedVariablesCtxt<'a, 'tcx: 'a> {
+struct MovedVariablesCtxt<'a, 'tcx> {
     cx: &'a LateContext<'a, 'tcx>,
     moved_vars: FxHashSet<HirId>,
     /// Spans which need to be prefixed with `*` for dereferencing the
index c2e4805fa7bbcf1138ec9e13fae0bea0e078062c..cc0192feb5cb4ab6d6ca4d6cc47c99c71e97843a 100644 (file)
@@ -77,7 +77,7 @@ struct ExistingName {
     whitelist: &'static [&'static str],
 }
 
-struct SimilarNamesLocalVisitor<'a, 'tcx: 'a> {
+struct SimilarNamesLocalVisitor<'a, 'tcx> {
     names: Vec<ExistingName>,
     cx: &'a EarlyContext<'tcx>,
     lint: &'a NonExpressiveNames,
@@ -86,7 +86,7 @@ struct SimilarNamesLocalVisitor<'a, 'tcx: 'a> {
     single_char_names: Vec<Vec<Ident>>,
 }
 
-impl<'a, 'tcx: 'a> SimilarNamesLocalVisitor<'a, 'tcx> {
+impl<'a, 'tcx> SimilarNamesLocalVisitor<'a, 'tcx> {
     fn check_single_char_names(&self) {
         let num_single_char_names = self.single_char_names.iter().flatten().count();
         let threshold = self.lint.single_char_binding_names_threshold;
@@ -123,9 +123,9 @@ fn check_single_char_names(&self) {
     &["lit", "lint"],
 ];
 
-struct SimilarNamesNameVisitor<'a: 'b, 'tcx: 'a, 'b>(&'b mut SimilarNamesLocalVisitor<'a, 'tcx>);
+struct SimilarNamesNameVisitor<'a, 'tcx, 'b>(&'b mut SimilarNamesLocalVisitor<'a, 'tcx>);
 
-impl<'a, 'tcx: 'a, 'b> Visitor<'tcx> for SimilarNamesNameVisitor<'a, 'tcx, 'b> {
+impl<'a, 'tcx, 'b> Visitor<'tcx> for SimilarNamesNameVisitor<'a, 'tcx, 'b> {
     fn visit_pat(&mut self, pat: &'tcx Pat) {
         match pat.node {
             PatKind::Ident(_, ident, _) => self.check_ident(ident),
index 2d85189d111da2dd397696fe4dd0b7676fd5398b..95cd118c98ebaaba0b72d1fc4c71cc9b52d2b917 100644 (file)
@@ -236,7 +236,7 @@ fn check_pat<'a, 'tcx>(
     }
 }
 
-fn lint_shadow<'a, 'tcx: 'a>(
+fn lint_shadow<'a, 'tcx>(
     cx: &LateContext<'a, 'tcx>,
     name: Name,
     span: Span,
index 4e434351eb0264a7fd5e829fb1fd045b904667cc..dde9412c52e830534796791d36e0040993a30ac0 100644 (file)
@@ -180,7 +180,7 @@ fn emit_lint<'tcx>(
 
 /// `VectorInitializationVisitor` searches for unsafe or slow vector initializations for the given
 /// vector.
-struct VectorInitializationVisitor<'a, 'tcx: 'a> {
+struct VectorInitializationVisitor<'a, 'tcx> {
     cx: &'a LateContext<'a, 'tcx>,
 
     /// Contains the information.
index fbce50f9ef84d98e75377538ce6902c93b2fcdc5..a480d98b2fd1d75af997236dd3d1ade6c48d7fe6 100644 (file)
@@ -183,7 +183,7 @@ struct BinaryExprVisitor {
     in_binary_expr: bool,
 }
 
-impl<'a, 'tcx: 'a> Visitor<'tcx> for BinaryExprVisitor {
+impl<'a, 'tcx> Visitor<'tcx> for BinaryExprVisitor {
     fn visit_expr(&mut self, expr: &'tcx hir::Expr) {
         match expr.node {
             hir::ExprKind::Binary(..)
index 1841961979d1d9db28fc6806fc6c90b2ee985a1f..f484dc7987530d3f9bfc971c37948b25e3ab611e 100644 (file)
@@ -2136,18 +2136,18 @@ fn span(&self) -> Span {
     }
 }
 
-struct ImplicitHasherTypeVisitor<'a, 'tcx: 'a> {
+struct ImplicitHasherTypeVisitor<'a, 'tcx> {
     cx: &'a LateContext<'a, 'tcx>,
     found: Vec<ImplicitHasherType<'tcx>>,
 }
 
-impl<'a, 'tcx: 'a> ImplicitHasherTypeVisitor<'a, 'tcx> {
+impl<'a, 'tcx> ImplicitHasherTypeVisitor<'a, 'tcx> {
     fn new(cx: &'a LateContext<'a, 'tcx>) -> Self {
         Self { cx, found: vec![] }
     }
 }
 
-impl<'a, 'tcx: 'a> Visitor<'tcx> for ImplicitHasherTypeVisitor<'a, 'tcx> {
+impl<'a, 'tcx> Visitor<'tcx> for ImplicitHasherTypeVisitor<'a, 'tcx> {
     fn visit_ty(&mut self, t: &'tcx hir::Ty) {
         if let Some(target) = ImplicitHasherType::new(self.cx, t) {
             self.found.push(target);
@@ -2162,14 +2162,14 @@ fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
 }
 
 /// Looks for default-hasher-dependent constructors like `HashMap::new`.
-struct ImplicitHasherConstructorVisitor<'a, 'b, 'tcx: 'a + 'b> {
+struct ImplicitHasherConstructorVisitor<'a, 'b, 'tcx> {
     cx: &'a LateContext<'a, 'tcx>,
     body: &'a TypeckTables<'tcx>,
     target: &'b ImplicitHasherType<'tcx>,
     suggestions: BTreeMap<Span, String>,
 }
 
-impl<'a, 'b, 'tcx: 'a + 'b> ImplicitHasherConstructorVisitor<'a, 'b, 'tcx> {
+impl<'a, 'b, 'tcx> ImplicitHasherConstructorVisitor<'a, 'b, 'tcx> {
     fn new(cx: &'a LateContext<'a, 'tcx>, target: &'b ImplicitHasherType<'tcx>) -> Self {
         Self {
             cx,
@@ -2180,7 +2180,7 @@ fn new(cx: &'a LateContext<'a, 'tcx>, target: &'b ImplicitHasherType<'tcx>) -> S
     }
 }
 
-impl<'a, 'b, 'tcx: 'a + 'b> Visitor<'tcx> for ImplicitHasherConstructorVisitor<'a, 'b, 'tcx> {
+impl<'a, 'b, 'tcx> Visitor<'tcx> for ImplicitHasherConstructorVisitor<'a, 'b, 'tcx> {
     fn visit_body(&mut self, body: &'tcx Body) {
         let prev_body = self.body;
         self.body = self.cx.tcx.body_tables(body.id());
index 4b41a02de974b276b9c110144fd2b621f813d091..a9d78d30f2bf48d748a605f6ac0518bb90ef471a 100644 (file)
@@ -27,7 +27,7 @@
     "unused labels"
 }
 
-struct UnusedLabelVisitor<'a, 'tcx: 'a> {
+struct UnusedLabelVisitor<'a, 'tcx> {
     labels: FxHashMap<LocalInternedString, Span>,
     cx: &'a LateContext<'a, 'tcx>,
 }
@@ -60,7 +60,7 @@ fn check_fn(
     }
 }
 
-impl<'a, 'tcx: 'a> Visitor<'tcx> for UnusedLabelVisitor<'a, 'tcx> {
+impl<'a, 'tcx> Visitor<'tcx> for UnusedLabelVisitor<'a, 'tcx> {
     fn visit_expr(&mut self, expr: &'tcx hir::Expr) {
         match expr.node {
             hir::ExprKind::Break(destination, _) | hir::ExprKind::Continue(destination) => {
index 555a4f3f77926a6bb46f8bbf71f2ede30bdef1d6..568087b366797fc3610253aaf34f945252ef364d 100644 (file)
@@ -57,7 +57,7 @@
 }
 
 /// Visitor that keeps track of which variables are unwrappable.
-struct UnwrappableVariablesVisitor<'a, 'tcx: 'a> {
+struct UnwrappableVariablesVisitor<'a, 'tcx> {
     unwrappables: Vec<UnwrapInfo<'tcx>>,
     cx: &'a LateContext<'a, 'tcx>,
 }
@@ -74,7 +74,7 @@ struct UnwrapInfo<'tcx> {
 
 /// Collects the information about unwrappable variables from an if condition
 /// The `invert` argument tells us whether the condition is negated.
-fn collect_unwrap_info<'a, 'tcx: 'a>(
+fn collect_unwrap_info<'a, 'tcx>(
     cx: &'a LateContext<'a, 'tcx>,
     expr: &'tcx Expr,
     invert: bool,
@@ -113,7 +113,7 @@ fn collect_unwrap_info<'a, 'tcx: 'a>(
     Vec::new()
 }
 
-impl<'a, 'tcx: 'a> UnwrappableVariablesVisitor<'a, 'tcx> {
+impl<'a, 'tcx> UnwrappableVariablesVisitor<'a, 'tcx> {
     fn visit_branch(&mut self, cond: &'tcx Expr, branch: &'tcx Expr, else_branch: bool) {
         let prev_len = self.unwrappables.len();
         for unwrap_info in collect_unwrap_info(self.cx, cond, else_branch) {
@@ -130,7 +130,7 @@ fn visit_branch(&mut self, cond: &'tcx Expr, branch: &'tcx Expr, else_branch: bo
     }
 }
 
-impl<'a, 'tcx: 'a> Visitor<'tcx> for UnwrappableVariablesVisitor<'a, 'tcx> {
+impl<'a, 'tcx> Visitor<'tcx> for UnwrappableVariablesVisitor<'a, 'tcx> {
     fn visit_expr(&mut self, expr: &'tcx Expr) {
         if let Some((cond, then, els)) = if_block(&expr) {
             walk_expr(self, cond);
index c18922a394c72083df06321055ac4c05cd6add0a..96e725c42297b29c8abf34250ce436d2a05ae9b5 100644 (file)
@@ -68,7 +68,7 @@ fn span_use_self_lint(cx: &LateContext<'_, '_>, path: &Path) {
     );
 }
 
-struct TraitImplTyVisitor<'a, 'tcx: 'a> {
+struct TraitImplTyVisitor<'a, 'tcx> {
     item_type: Ty<'tcx>,
     cx: &'a LateContext<'a, 'tcx>,
     trait_type_walker: ty::walk::TypeWalker<'tcx>,
@@ -108,7 +108,7 @@ fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
     }
 }
 
-fn check_trait_method_impl_decl<'a, 'tcx: 'a>(
+fn check_trait_method_impl_decl<'a, 'tcx>(
     cx: &'a LateContext<'a, 'tcx>,
     item_type: Ty<'tcx>,
     impl_item: &ImplItem,
@@ -213,7 +213,7 @@ fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
     }
 }
 
-struct UseSelfVisitor<'a, 'tcx: 'a> {
+struct UseSelfVisitor<'a, 'tcx> {
     item_path: &'a Path,
     cx: &'a LateContext<'a, 'tcx>,
 }
index 7f58d21a3158b14822338e5db89e37b2a021e1f4..3a54c5d0a02c9d61318e53fbc7a71c921bea249b 100644 (file)
@@ -14,7 +14,7 @@
 /// span.
 ///
 /// Note that some expressions kinds are not considered but could be added.
-pub struct SpanlessEq<'a, 'tcx: 'a> {
+pub struct SpanlessEq<'a, 'tcx> {
     /// Context used to evaluate constant expressions.
     cx: &'a LateContext<'a, 'tcx>,
     tables: &'a TypeckTables<'tcx>,
@@ -23,7 +23,7 @@ pub struct SpanlessEq<'a, 'tcx: 'a> {
     ignore_fn: bool,
 }
 
-impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
+impl<'a, 'tcx> SpanlessEq<'a, 'tcx> {
     pub fn new(cx: &'a LateContext<'a, 'tcx>) -> Self {
         Self {
             cx,
@@ -349,14 +349,14 @@ fn over<X, F>(left: &[X], right: &[X], mut eq_fn: F) -> bool
 /// trait would consider IDs and spans.
 ///
 /// All expressions kind are hashed, but some might have a weaker hash.
-pub struct SpanlessHash<'a, 'tcx: 'a> {
+pub struct SpanlessHash<'a, 'tcx> {
     /// Context used to evaluate constant expressions.
     cx: &'a LateContext<'a, 'tcx>,
     tables: &'a TypeckTables<'tcx>,
     s: DefaultHasher,
 }
 
-impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
+impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
     pub fn new(cx: &'a LateContext<'a, 'tcx>, tables: &'a TypeckTables<'tcx>) -> Self {
         Self {
             cx,
index 44cdba8ce344ebfc0bf2d3829a2e15778c161842..aba2543b13c8455e17a7c39da252b55e558320be 100644 (file)
@@ -217,12 +217,12 @@ fn is_lint_ref_type<'tcx>(cx: &LateContext<'_, 'tcx>, ty: &Ty) -> bool {
     false
 }
 
-struct LintCollector<'a, 'tcx: 'a> {
+struct LintCollector<'a, 'tcx> {
     output: &'a mut FxHashSet<Name>,
     cx: &'a LateContext<'a, 'tcx>,
 }
 
-impl<'a, 'tcx: 'a> Visitor<'tcx> for LintCollector<'a, 'tcx> {
+impl<'a, 'tcx> Visitor<'tcx> for LintCollector<'a, 'tcx> {
     fn visit_expr(&mut self, expr: &'tcx Expr) {
         walk_expr(self, expr);
     }
index afaaa9e81c60a0ff7064768cd0c680ee4ab415a6..bee44d092ee851789ec9b1fe877cff1cd80beed5 100644 (file)
@@ -605,7 +605,7 @@ pub fn get_parent_expr<'c>(cx: &'c LateContext<'_, '_>, e: &Expr) -> Option<&'c
     })
 }
 
-pub fn get_enclosing_block<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, hir_id: HirId) -> Option<&'tcx Block> {
+pub fn get_enclosing_block<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, hir_id: HirId) -> Option<&'tcx Block> {
     let map = &cx.tcx.hir();
     let enclosing_node = map
         .get_enclosing_scope(hir_id)
index fb2e3a38d778e1610169b29c6a8f38d3c3f74b53..e378ef0c0a90403950abef0c2aff7c2a79af5fa2 100644 (file)
@@ -22,7 +22,7 @@ pub fn get_spans(
     }
 }
 
-fn extract_clone_suggestions<'a, 'tcx: 'a>(
+fn extract_clone_suggestions<'a, 'tcx>(
     cx: &LateContext<'a, 'tcx>,
     name: Name,
     replace: &[(&'static str, &'static str)],
@@ -43,7 +43,7 @@ fn extract_clone_suggestions<'a, 'tcx: 'a>(
     }
 }
 
-struct PtrCloneVisitor<'a, 'tcx: 'a> {
+struct PtrCloneVisitor<'a, 'tcx> {
     cx: &'a LateContext<'a, 'tcx>,
     name: Name,
     replace: &'a [(&'static str, &'static str)],
@@ -51,7 +51,7 @@ struct PtrCloneVisitor<'a, 'tcx: 'a> {
     abort: bool,
 }
 
-impl<'a, 'tcx: 'a> Visitor<'tcx> for PtrCloneVisitor<'a, 'tcx> {
+impl<'a, 'tcx> Visitor<'tcx> for PtrCloneVisitor<'a, 'tcx> {
     fn visit_expr(&mut self, expr: &'tcx Expr) {
         if self.abort {
             return;
index 014dc9d4d8014a301093984148c85004c5bc1a40..5474837d8a7870316799583451455f9e3fa603f2 100644 (file)
@@ -9,7 +9,7 @@
 use syntax::source_map::Span;
 
 /// Returns a set of mutated local variable IDs, or `None` if mutations could not be determined.
-pub fn mutated_variables<'a, 'tcx: 'a>(expr: &'tcx Expr, cx: &'a LateContext<'a, 'tcx>) -> Option<FxHashSet<HirId>> {
+pub fn mutated_variables<'a, 'tcx>(expr: &'tcx Expr, cx: &'a LateContext<'a, 'tcx>) -> Option<FxHashSet<HirId>> {
     let mut delegate = MutVarsDelegate {
         used_mutably: FxHashSet::default(),
         skip: false,
@@ -33,11 +33,7 @@ pub fn mutated_variables<'a, 'tcx: 'a>(expr: &'tcx Expr, cx: &'a LateContext<'a,
     Some(delegate.used_mutably)
 }
 
-pub fn is_potentially_mutated<'a, 'tcx: 'a>(
-    variable: &'tcx Path,
-    expr: &'tcx Expr,
-    cx: &'a LateContext<'a, 'tcx>,
-) -> bool {
+pub fn is_potentially_mutated<'a, 'tcx>(variable: &'tcx Path, expr: &'tcx Expr, cx: &'a LateContext<'a, 'tcx>) -> bool {
     if let Res::Local(id) = variable.res {
         mutated_variables(expr, cx).map_or(true, |mutated| mutated.contains(&id))
     } else {
index 82aec070b404bdaef3dee8701af51e545cedef23..dbc7d597b2c1fc8cdf0c557db5b0836b5f1a813d 100644 (file)
@@ -122,9 +122,9 @@ pub unsafe fn new() -> Self {
 }
 
 #[derive(Default)]
-pub struct OptionRefWrapper<'a, T: 'a>(Option<&'a T>);
+pub struct OptionRefWrapper<'a, T>(Option<&'a T>);
 
-impl<'a, T: 'a> OptionRefWrapper<'a, T> {
+impl<'a, T> OptionRefWrapper<'a, T> {
     pub fn new() -> Self {
         OptionRefWrapper(None)
     }
index 86964f8480a48802ed6eacd69f74015e172c3044..6ec7697c0d6e88458ed2f7815600054d063cdbd4 100644 (file)
@@ -53,7 +53,7 @@ unsafe fn _ptr_to_ref<T, U>(p: *const T, m: *mut T, o: *const U, om: *mut U) {
 
 #[warn(clippy::transmute_ptr_to_ref)]
 fn issue1231() {
-    struct Foo<'a, T: 'a> {
+    struct Foo<'a, T> {
         bar: &'a T,
     }