From 7b1b08cfee6881705eed931e24b8abd4e68ef328 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sat, 7 Mar 2020 00:56:32 +0100 Subject: [PATCH] remove lifetimes that can be elided (clippy::needless_lifetimes) --- src/liballoc/collections/linked_list.rs | 2 +- src/librustc/dep_graph/dep_node.rs | 2 +- src/librustc/hir/map/collector.rs | 2 +- src/librustc/hir/map/hir_id_validator.rs | 2 +- src/librustc/mir/mod.rs | 4 ++-- src/librustc_codegen_llvm/common.rs | 4 ++-- src/librustc_codegen_llvm/llvm/mod.rs | 6 ++--- src/librustc_codegen_llvm/type_.rs | 2 +- src/librustc_data_structures/graph/scc/mod.rs | 2 +- .../graph/vec_graph/mod.rs | 2 +- src/librustc_driver/pretty.rs | 22 +++++++++---------- src/librustc_hir/intravisit.rs | 2 +- src/librustc_incremental/assert_dep_graph.rs | 2 +- .../persist/dirty_clean.rs | 2 +- .../infer/error_reporting/need_type_info.rs | 2 +- .../nice_region_error/find_anon_type.rs | 2 +- src/librustc_infer/traits/coherence.rs | 2 +- src/librustc_lint/late.rs | 4 ++-- src/librustc_lint/levels.rs | 2 +- src/librustc_mir/const_eval/mod.rs | 2 +- src/librustc_mir/transform/add_retag.rs | 2 +- src/librustc_mir/transform/check_unsafety.rs | 2 +- src/librustc_mir/transform/mod.rs | 2 +- src/librustc_parse/lib.rs | 6 ++--- src/librustc_passes/check_attr.rs | 2 +- src/librustc_passes/lang_items.rs | 2 +- src/librustc_passes/upvars.rs | 4 ++-- src/librustc_traits/lowering/mod.rs | 2 +- src/librustc_ty/ty.rs | 2 +- src/librustc_typeck/check/coercion.rs | 2 +- src/librustc_typeck/check/op.rs | 2 +- src/librustc_typeck/coherence/builtin.rs | 2 +- 32 files changed, 50 insertions(+), 50 deletions(-) diff --git a/src/liballoc/collections/linked_list.rs b/src/liballoc/collections/linked_list.rs index 73ae267ddab7f..53d4f7239b76e 100644 --- a/src/liballoc/collections/linked_list.rs +++ b/src/liballoc/collections/linked_list.rs @@ -1427,7 +1427,7 @@ impl<'a, T> CursorMut<'a, T> { /// `CursorMut`, which means it cannot outlive the `CursorMut` and that the /// `CursorMut` is frozen for the lifetime of the `Cursor`. #[unstable(feature = "linked_list_cursors", issue = "58533")] - pub fn as_cursor<'cm>(&'cm self) -> Cursor<'cm, T> { + pub fn as_cursor(&self) -> Cursor<'_, T> { Cursor { list: self.list, current: self.current, index: self.index } } } diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs index 5cbaa5a42f678..03218920ef1aa 100644 --- a/src/librustc/dep_graph/dep_node.rs +++ b/src/librustc/dep_graph/dep_node.rs @@ -179,7 +179,7 @@ macro_rules! define_dep_nodes { $( #[inline(always)] #[allow(unreachable_code, non_snake_case)] - pub fn $variant<'tcx>(_tcx: TyCtxt<'tcx>, $(arg: $tuple_arg_ty)*) -> DepNode { + pub fn $variant(_tcx: TyCtxt<'_>, $(arg: $tuple_arg_ty)*) -> DepNode { // tuple args $({ erase!($tuple_arg_ty); diff --git a/src/librustc/hir/map/collector.rs b/src/librustc/hir/map/collector.rs index ebd335ab35504..ca5f9ba5ad62d 100644 --- a/src/librustc/hir/map/collector.rs +++ b/src/librustc/hir/map/collector.rs @@ -340,7 +340,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> { /// deep walking so that we walk nested items in the context of /// their outer items. - fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Self::Map> { + fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> { panic!("`visit_nested_xxx` must be manually implemented in this visitor"); } diff --git a/src/librustc/hir/map/hir_id_validator.rs b/src/librustc/hir/map/hir_id_validator.rs index a4f9193c0eb64..f176f92434372 100644 --- a/src/librustc/hir/map/hir_id_validator.rs +++ b/src/librustc/hir/map/hir_id_validator.rs @@ -135,7 +135,7 @@ impl<'a, 'hir> HirIdValidator<'a, 'hir> { impl<'a, 'hir> intravisit::Visitor<'hir> for HirIdValidator<'a, 'hir> { type Map = Map<'hir>; - fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, Self::Map> { + fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<'_, Self::Map> { intravisit::NestedVisitorMap::OnlyBodies(self.hir_map) } diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index b2413f5a2c83f..ec882e02c603b 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -403,7 +403,7 @@ pub enum ClearCrossCrate { } impl ClearCrossCrate { - pub fn as_ref(&'a self) -> ClearCrossCrate<&'a T> { + pub fn as_ref(&self) -> ClearCrossCrate<&T> { match self { ClearCrossCrate::Clear => ClearCrossCrate::Clear, ClearCrossCrate::Set(v) => ClearCrossCrate::Set(v), @@ -2503,7 +2503,7 @@ impl UserTypeProjection { pub(crate) fn variant( mut self, - adt_def: &'tcx AdtDef, + adt_def: &AdtDef, variant_index: VariantIdx, field: Field, ) -> Self { diff --git a/src/librustc_codegen_llvm/common.rs b/src/librustc_codegen_llvm/common.rs index df38eeec00fce..6293d5ddd3bc0 100644 --- a/src/librustc_codegen_llvm/common.rs +++ b/src/librustc_codegen_llvm/common.rs @@ -320,7 +320,7 @@ impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> { } } -pub fn val_ty(v: &'ll Value) -> &'ll Type { +pub fn val_ty(v: &Value) -> &Type { unsafe { llvm::LLVMTypeOf(v) } } @@ -342,6 +342,6 @@ fn hi_lo_to_u128(lo: u64, hi: u64) -> u128 { ((hi as u128) << 64) | (lo as u128) } -fn try_as_const_integral(v: &'ll Value) -> Option<&'ll ConstantInt> { +fn try_as_const_integral(v: &Value) -> Option<&ConstantInt> { unsafe { llvm::LLVMIsAConstantInt(v) } } diff --git a/src/librustc_codegen_llvm/llvm/mod.rs b/src/librustc_codegen_llvm/llvm/mod.rs index 96014cbee5da1..a083e14979c0b 100644 --- a/src/librustc_codegen_llvm/llvm/mod.rs +++ b/src/librustc_codegen_llvm/llvm/mod.rs @@ -185,12 +185,12 @@ impl Drop for SectionIter<'a> { } } -pub fn mk_section_iter(llof: &'a ffi::ObjectFile) -> SectionIter<'a> { +pub fn mk_section_iter(llof: &ffi::ObjectFile) -> SectionIter<'_> { unsafe { SectionIter { llsi: LLVMGetSections(llof) } } } /// Safe wrapper around `LLVMGetParam`, because segfaults are no fun. -pub fn get_param(llfn: &'a Value, index: c_uint) -> &'a Value { +pub fn get_param(llfn: &Value, index: c_uint) -> &Value { unsafe { assert!( index < LLVMCountParams(llfn), @@ -203,7 +203,7 @@ pub fn get_param(llfn: &'a Value, index: c_uint) -> &'a Value { } /// Safe wrapper for `LLVMGetValueName2` into a byte slice -pub fn get_value_name(value: &'a Value) -> &'a [u8] { +pub fn get_value_name(value: &Value) -> &[u8] { unsafe { let mut len = 0; let data = LLVMGetValueName2(value, &mut len); diff --git a/src/librustc_codegen_llvm/type_.rs b/src/librustc_codegen_llvm/type_.rs index aacaf130f9aa9..5bc1475df23a7 100644 --- a/src/librustc_codegen_llvm/type_.rs +++ b/src/librustc_codegen_llvm/type_.rs @@ -240,7 +240,7 @@ impl Type { unsafe { llvm::LLVMIntTypeInContext(llcx, num_bits as c_uint) } } - pub fn i8p_llcx(llcx: &'ll llvm::Context) -> &'ll Type { + pub fn i8p_llcx(llcx: &llvm::Context) -> &Type { Type::i8_llcx(llcx).ptr_to() } diff --git a/src/librustc_data_structures/graph/scc/mod.rs b/src/librustc_data_structures/graph/scc/mod.rs index 70fc2d7dad9ee..7ecf3e3cb8d5d 100644 --- a/src/librustc_data_structures/graph/scc/mod.rs +++ b/src/librustc_data_structures/graph/scc/mod.rs @@ -97,7 +97,7 @@ impl GraphSuccessors<'graph> for Sccs { } impl WithSuccessors for Sccs { - fn successors<'graph>(&'graph self, node: S) -> >::Iter { + fn successors(&self, node: S) -> >::Iter { self.successors(node).iter().cloned() } } diff --git a/src/librustc_data_structures/graph/vec_graph/mod.rs b/src/librustc_data_structures/graph/vec_graph/mod.rs index 22c50afe6d0b4..064467174cae2 100644 --- a/src/librustc_data_structures/graph/vec_graph/mod.rs +++ b/src/librustc_data_structures/graph/vec_graph/mod.rs @@ -101,7 +101,7 @@ impl GraphSuccessors<'graph> for VecGraph { } impl WithSuccessors for VecGraph { - fn successors<'graph>(&'graph self, node: N) -> >::Iter { + fn successors(&self, node: N) -> >::Iter { self.successors(node).iter().cloned() } } diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index ca129ac59849a..65fe1fec52643 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -96,7 +96,7 @@ trait PrinterSupport: pprust::PpAnn { /// /// (Rust does not yet support upcasting from a trait object to /// an object for one of its super-traits.) - fn pp_ann<'a>(&'a self) -> &'a dyn pprust::PpAnn; + fn pp_ann(&self) -> &dyn pprust::PpAnn; } trait HirPrinterSupport<'hir>: pprust_hir::PpAnn { @@ -106,13 +106,13 @@ trait HirPrinterSupport<'hir>: pprust_hir::PpAnn { /// Provides a uniform interface for re-extracting a reference to an /// `hir_map::Map` from a value that now owns it. - fn hir_map<'a>(&'a self) -> Option<&'a hir_map::Map<'hir>>; + fn hir_map(&self) -> Option<&hir_map::Map<'hir>>; /// Produces the pretty-print annotation object. /// /// (Rust does not yet support upcasting from a trait object to /// an object for one of its super-traits.) - fn pp_ann<'a>(&'a self) -> &'a dyn pprust_hir::PpAnn; + fn pp_ann(&self) -> &dyn pprust_hir::PpAnn; /// Computes an user-readable representation of a path, if possible. fn node_path(&self, id: hir::HirId) -> Option { @@ -132,7 +132,7 @@ impl<'hir> PrinterSupport for NoAnn<'hir> { self.sess } - fn pp_ann<'a>(&'a self) -> &'a dyn pprust::PpAnn { + fn pp_ann(&self) -> &dyn pprust::PpAnn { self } } @@ -142,11 +142,11 @@ impl<'hir> HirPrinterSupport<'hir> for NoAnn<'hir> { self.sess } - fn hir_map<'a>(&'a self) -> Option<&'a hir_map::Map<'hir>> { + fn hir_map(&self) -> Option<&hir_map::Map<'hir>> { self.tcx.map(|tcx| *tcx.hir()) } - fn pp_ann<'a>(&'a self) -> &'a dyn pprust_hir::PpAnn { + fn pp_ann(&self) -> &dyn pprust_hir::PpAnn { self } } @@ -170,7 +170,7 @@ impl<'hir> PrinterSupport for IdentifiedAnnotation<'hir> { self.sess } - fn pp_ann<'a>(&'a self) -> &'a dyn pprust::PpAnn { + fn pp_ann(&self) -> &dyn pprust::PpAnn { self } } @@ -216,11 +216,11 @@ impl<'hir> HirPrinterSupport<'hir> for IdentifiedAnnotation<'hir> { self.sess } - fn hir_map<'a>(&'a self) -> Option<&'a hir_map::Map<'hir>> { + fn hir_map(&self) -> Option<&hir_map::Map<'hir>> { self.tcx.map(|tcx| *tcx.hir()) } - fn pp_ann<'a>(&'a self) -> &'a dyn pprust_hir::PpAnn { + fn pp_ann(&self) -> &dyn pprust_hir::PpAnn { self } } @@ -315,11 +315,11 @@ impl<'b, 'tcx> HirPrinterSupport<'tcx> for TypedAnnotation<'b, 'tcx> { &self.tcx.sess } - fn hir_map<'a>(&'a self) -> Option<&'a hir_map::Map<'tcx>> { + fn hir_map(&self) -> Option<&hir_map::Map<'tcx>> { Some(&self.tcx.hir()) } - fn pp_ann<'a>(&'a self) -> &'a dyn pprust_hir::PpAnn { + fn pp_ann(&self) -> &dyn pprust_hir::PpAnn { self } diff --git a/src/librustc_hir/intravisit.rs b/src/librustc_hir/intravisit.rs index 45257b04d7907..6191a5137ccaf 100644 --- a/src/librustc_hir/intravisit.rs +++ b/src/librustc_hir/intravisit.rs @@ -284,7 +284,7 @@ pub trait Visitor<'v>: Sized { /// If you use this, you probably don't want to process the /// contents of nested item-like things, since the outer loop will /// visit them as well. - fn as_deep_visitor<'s>(&'s mut self) -> DeepVisitor<'s, Self> { + fn as_deep_visitor(&mut self) -> DeepVisitor<'_, Self> { DeepVisitor::new(self) } diff --git a/src/librustc_incremental/assert_dep_graph.rs b/src/librustc_incremental/assert_dep_graph.rs index c82ed0c2c4970..c2b62f9670c8b 100644 --- a/src/librustc_incremental/assert_dep_graph.rs +++ b/src/librustc_incremental/assert_dep_graph.rs @@ -162,7 +162,7 @@ impl IfThisChanged<'tcx> { impl Visitor<'tcx> for IfThisChanged<'tcx> { type Map = Map<'tcx>; - fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Self::Map> { + fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> { NestedVisitorMap::OnlyBodies(&self.tcx.hir()) } diff --git a/src/librustc_incremental/persist/dirty_clean.rs b/src/librustc_incremental/persist/dirty_clean.rs index e212dc81070ac..d22417980cdb2 100644 --- a/src/librustc_incremental/persist/dirty_clean.rs +++ b/src/librustc_incremental/persist/dirty_clean.rs @@ -548,7 +548,7 @@ impl FindAllAttrs<'tcx> { impl intravisit::Visitor<'tcx> for FindAllAttrs<'tcx> { type Map = Map<'tcx>; - fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, Self::Map> { + fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<'_, Self::Map> { intravisit::NestedVisitorMap::All(&self.tcx.hir()) } diff --git a/src/librustc_infer/infer/error_reporting/need_type_info.rs b/src/librustc_infer/infer/error_reporting/need_type_info.rs index 285f0c9cf51a9..94976266467b0 100644 --- a/src/librustc_infer/infer/error_reporting/need_type_info.rs +++ b/src/librustc_infer/infer/error_reporting/need_type_info.rs @@ -69,7 +69,7 @@ impl<'a, 'tcx> FindLocalByTypeVisitor<'a, 'tcx> { impl<'a, 'tcx> Visitor<'tcx> for FindLocalByTypeVisitor<'a, 'tcx> { type Map = Map<'tcx>; - fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Self::Map> { + fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> { NestedVisitorMap::OnlyBodies(&self.hir_map) } diff --git a/src/librustc_infer/infer/error_reporting/nice_region_error/find_anon_type.rs b/src/librustc_infer/infer/error_reporting/nice_region_error/find_anon_type.rs index 2ae7f4cc04f98..14cf35932c494 100644 --- a/src/librustc_infer/infer/error_reporting/nice_region_error/find_anon_type.rs +++ b/src/librustc_infer/infer/error_reporting/nice_region_error/find_anon_type.rs @@ -93,7 +93,7 @@ struct FindNestedTypeVisitor<'tcx> { impl Visitor<'tcx> for FindNestedTypeVisitor<'tcx> { type Map = Map<'tcx>; - fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Self::Map> { + fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> { NestedVisitorMap::OnlyBodies(&self.tcx.hir()) } diff --git a/src/librustc_infer/traits/coherence.rs b/src/librustc_infer/traits/coherence.rs index 15c5f4d402ac3..2096c93e10694 100644 --- a/src/librustc_infer/traits/coherence.rs +++ b/src/librustc_infer/traits/coherence.rs @@ -451,7 +451,7 @@ fn def_id_is_local(def_id: DefId, in_crate: InCrate) -> bool { } } -fn ty_is_non_local_constructor<'tcx>(ty: Ty<'tcx>, in_crate: InCrate) -> Option> { +fn ty_is_non_local_constructor(ty: Ty<'_>, in_crate: InCrate) -> Option> { debug!("ty_is_non_local_constructor({:?})", ty); match ty.kind { diff --git a/src/librustc_lint/late.rs b/src/librustc_lint/late.rs index ee03232a0ce4c..0964dfa28998e 100644 --- a/src/librustc_lint/late.rs +++ b/src/librustc_lint/late.rs @@ -33,7 +33,7 @@ use std::slice; /// Extract the `LintStore` from the query context. /// This function exists because we've erased `LintStore` as `dyn Any` in the context. -crate fn unerased_lint_store<'tcx>(tcx: TyCtxt<'tcx>) -> &'tcx LintStore { +crate fn unerased_lint_store(tcx: TyCtxt<'_>) -> &LintStore { let store: &dyn Any = &*tcx.lint_store; store.downcast_ref().unwrap() } @@ -99,7 +99,7 @@ impl<'a, 'tcx, T: LateLintPass<'a, 'tcx>> hir_visit::Visitor<'tcx> /// Because lints are scoped lexically, we want to walk nested /// items in the context of the outer item, so enable /// deep-walking. - fn nested_visit_map<'this>(&'this mut self) -> hir_visit::NestedVisitorMap<'this, Self::Map> { + fn nested_visit_map(&mut self) -> hir_visit::NestedVisitorMap<'_, Self::Map> { hir_visit::NestedVisitorMap::All(&self.context.tcx.hir()) } diff --git a/src/librustc_lint/levels.rs b/src/librustc_lint/levels.rs index e0db2ae64ff21..0e85b8d2a39ed 100644 --- a/src/librustc_lint/levels.rs +++ b/src/librustc_lint/levels.rs @@ -438,7 +438,7 @@ impl LintLevelMapBuilder<'_, '_> { impl<'tcx> intravisit::Visitor<'tcx> for LintLevelMapBuilder<'_, 'tcx> { type Map = Map<'tcx>; - fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, Self::Map> { + fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<'_, Self::Map> { intravisit::NestedVisitorMap::All(&self.tcx.hir()) } diff --git a/src/librustc_mir/const_eval/mod.rs b/src/librustc_mir/const_eval/mod.rs index cb6583976258b..605091d6c7d41 100644 --- a/src/librustc_mir/const_eval/mod.rs +++ b/src/librustc_mir/const_eval/mod.rs @@ -43,7 +43,7 @@ pub(crate) fn const_field<'tcx>( op_to_const(&ecx, field) } -pub(crate) fn const_caller_location<'tcx>( +pub(crate) fn const_caller_location( tcx: TyCtxt<'tcx>, (file, line, col): (Symbol, u32, u32), ) -> ConstValue<'tcx> { diff --git a/src/librustc_mir/transform/add_retag.rs b/src/librustc_mir/transform/add_retag.rs index 2306177c14b8a..aa9cad7ffc19f 100644 --- a/src/librustc_mir/transform/add_retag.rs +++ b/src/librustc_mir/transform/add_retag.rs @@ -34,7 +34,7 @@ fn is_stable(place: PlaceRef<'_>) -> bool { } /// Determine whether this type may be a reference (or box), and thus needs retagging. -fn may_be_reference<'tcx>(ty: Ty<'tcx>) -> bool { +fn may_be_reference(ty: Ty<'tcx>) -> bool { match ty.kind { // Primitive types that are not references ty::Bool diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index 4dcbcdcbae4a6..152a98c0c1aa2 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -453,7 +453,7 @@ struct UnusedUnsafeVisitor<'a> { impl<'a, 'tcx> intravisit::Visitor<'tcx> for UnusedUnsafeVisitor<'a> { type Map = Map<'tcx>; - fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, Self::Map> { + fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<'_, Self::Map> { intravisit::NestedVisitorMap::None } diff --git a/src/librustc_mir/transform/mod.rs b/src/librustc_mir/transform/mod.rs index 57e002bf3f3d6..95e2db7508099 100644 --- a/src/librustc_mir/transform/mod.rs +++ b/src/librustc_mir/transform/mod.rs @@ -87,7 +87,7 @@ fn mir_keys(tcx: TyCtxt<'_>, krate: CrateNum) -> &DefIdSet { intravisit::walk_struct_def(self, v) } type Map = Map<'tcx>; - fn nested_visit_map<'b>(&'b mut self) -> NestedVisitorMap<'b, Self::Map> { + fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> { NestedVisitorMap::None } } diff --git a/src/librustc_parse/lib.rs b/src/librustc_parse/lib.rs index fe75062ee503c..884499ff2dd48 100644 --- a/src/librustc_parse/lib.rs +++ b/src/librustc_parse/lib.rs @@ -271,11 +271,11 @@ pub fn stream_to_parser<'a>( /// The main usage of this function is outside of rustc, for those who uses /// librustc_ast as a library. Please do not remove this function while refactoring /// just because it is not used in rustc codebase! -pub fn stream_to_parser_with_base_dir<'a>( - sess: &'a ParseSess, +pub fn stream_to_parser_with_base_dir( + sess: &ParseSess, stream: TokenStream, base_dir: Directory, -) -> Parser<'a> { +) -> Parser<'_> { Parser::new(sess, stream, Some(base_dir), true, false, None) } diff --git a/src/librustc_passes/check_attr.rs b/src/librustc_passes/check_attr.rs index f1ed074d6ab77..7ee16de52beab 100644 --- a/src/librustc_passes/check_attr.rs +++ b/src/librustc_passes/check_attr.rs @@ -418,7 +418,7 @@ impl CheckAttrVisitor<'tcx> { impl Visitor<'tcx> for CheckAttrVisitor<'tcx> { type Map = Map<'tcx>; - fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Self::Map> { + fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> { NestedVisitorMap::OnlyBodies(&self.tcx.hir()) } diff --git a/src/librustc_passes/lang_items.rs b/src/librustc_passes/lang_items.rs index 5f5acc7fdf815..88e92bbdba1aa 100644 --- a/src/librustc_passes/lang_items.rs +++ b/src/librustc_passes/lang_items.rs @@ -143,7 +143,7 @@ impl LanguageItemCollector<'tcx> { } /// Traverses and collects all the lang items in all crates. -fn collect<'tcx>(tcx: TyCtxt<'tcx>) -> LanguageItems { +fn collect(tcx: TyCtxt<'_>) -> LanguageItems { // Initialize the collector. let mut collector = LanguageItemCollector::new(tcx); diff --git a/src/librustc_passes/upvars.rs b/src/librustc_passes/upvars.rs index a2397f273385a..6be4f130c1f96 100644 --- a/src/librustc_passes/upvars.rs +++ b/src/librustc_passes/upvars.rs @@ -46,7 +46,7 @@ struct LocalCollector { impl Visitor<'tcx> for LocalCollector { type Map = Map<'tcx>; - fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Self::Map> { + fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> { NestedVisitorMap::None } @@ -75,7 +75,7 @@ impl CaptureCollector<'_, '_> { impl Visitor<'tcx> for CaptureCollector<'a, 'tcx> { type Map = Map<'tcx>; - fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Self::Map> { + fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> { NestedVisitorMap::None } diff --git a/src/librustc_traits/lowering/mod.rs b/src/librustc_traits/lowering/mod.rs index 97b81c224d593..1c816decffa6d 100644 --- a/src/librustc_traits/lowering/mod.rs +++ b/src/librustc_traits/lowering/mod.rs @@ -603,7 +603,7 @@ impl ClauseDumper<'tcx> { impl Visitor<'tcx> for ClauseDumper<'tcx> { type Map = Map<'tcx>; - fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Self::Map> { + fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> { NestedVisitorMap::OnlyBodies(&self.tcx.hir()) } diff --git a/src/librustc_ty/ty.rs b/src/librustc_ty/ty.rs index 6bc29d0493e68..5a87cf4c10d0d 100644 --- a/src/librustc_ty/ty.rs +++ b/src/librustc_ty/ty.rs @@ -210,7 +210,7 @@ fn associated_item_def_ids(tcx: TyCtxt<'_>, def_id: DefId) -> &[DefId] { } } -fn associated_items<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx ty::AssociatedItems { +fn associated_items(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::AssociatedItems { let items = tcx.associated_item_def_ids(def_id).iter().map(|did| tcx.associated_item(*did)); tcx.arena.alloc(ty::AssociatedItems::new(items)) } diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index 3720b74d92e07..022b2e82964e0 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -111,7 +111,7 @@ fn identity(_: Ty<'_>) -> Vec> { vec![] } -fn simple<'tcx>(kind: Adjust<'tcx>) -> impl FnOnce(Ty<'tcx>) -> Vec> { +fn simple(kind: Adjust<'tcx>) -> impl FnOnce(Ty<'tcx>) -> Vec> { move |target| vec![Adjustment { kind, target }] } diff --git a/src/librustc_typeck/check/op.rs b/src/librustc_typeck/check/op.rs index bf3511a26143c..f7bbde35aa72e 100644 --- a/src/librustc_typeck/check/op.rs +++ b/src/librustc_typeck/check/op.rs @@ -860,7 +860,7 @@ enum Op { } /// Dereferences a single level of immutable referencing. -fn deref_ty_if_possible<'tcx>(ty: Ty<'tcx>) -> Ty<'tcx> { +fn deref_ty_if_possible(ty: Ty<'tcx>) -> Ty<'tcx> { match ty.kind { ty::Ref(_, ty, hir::Mutability::Not) => ty, _ => ty, diff --git a/src/librustc_typeck/coherence/builtin.rs b/src/librustc_typeck/coherence/builtin.rs index aa39a191b3df6..7d7d34e45a634 100644 --- a/src/librustc_typeck/coherence/builtin.rs +++ b/src/librustc_typeck/coherence/builtin.rs @@ -322,7 +322,7 @@ fn visit_implementation_of_dispatch_from_dyn(tcx: TyCtxt<'_>, impl_did: DefId) { } } -pub fn coerce_unsized_info<'tcx>(tcx: TyCtxt<'tcx>, impl_did: DefId) -> CoerceUnsizedInfo { +pub fn coerce_unsized_info(tcx: TyCtxt<'tcx>, impl_did: DefId) -> CoerceUnsizedInfo { debug!("compute_coerce_unsized_info(impl_did={:?})", impl_did); let coerce_unsized_trait = tcx.lang_items().coerce_unsized_trait().unwrap();