From 004efa27059441651b240ee1a408d40f420413f8 Mon Sep 17 00:00:00 2001 From: Jeremy Stucki Date: Fri, 21 Jun 2019 11:39:28 +0200 Subject: [PATCH] Remove needless lifetimes --- src/librustc/ty/constness.rs | 8 ++++---- src/librustc/ty/context.rs | 6 +++--- src/librustc/ty/fast_reject.rs | 4 ++-- src/librustc/ty/mod.rs | 24 ++++++++++++------------ src/librustc/ty/trait_def.rs | 6 +++--- src/librustc/ty/walk.rs | 2 +- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/librustc/ty/constness.rs b/src/librustc/ty/constness.rs index 65b83224ae521..9e8857741b27b 100644 --- a/src/librustc/ty/constness.rs +++ b/src/librustc/ty/constness.rs @@ -67,9 +67,9 @@ impl<'tcx> TyCtxt<'tcx> { } -pub fn provide<'tcx>(providers: &mut Providers<'tcx>) { +pub fn provide(providers: &mut Providers<'_>) { /// only checks whether the function has a `const` modifier - fn is_const_fn_raw<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> bool { + fn is_const_fn_raw(tcx: TyCtxt<'_>, def_id: DefId) -> bool { let hir_id = tcx.hir().as_local_hir_id(def_id) .expect("Non-local call to local provider is_const_fn"); @@ -83,7 +83,7 @@ pub fn provide<'tcx>(providers: &mut Providers<'tcx>) { } } - fn is_promotable_const_fn<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> bool { + fn is_promotable_const_fn(tcx: TyCtxt<'_>, def_id: DefId) -> bool { tcx.is_const_fn(def_id) && match tcx.lookup_stability(def_id) { Some(stab) => { if cfg!(debug_assertions) && stab.promotable { @@ -101,7 +101,7 @@ pub fn provide<'tcx>(providers: &mut Providers<'tcx>) { } } - fn const_fn_is_allowed_fn_ptr<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> bool { + fn const_fn_is_allowed_fn_ptr(tcx: TyCtxt<'_>, def_id: DefId) -> bool { tcx.is_const_fn(def_id) && tcx.lookup_stability(def_id) .map(|stab| stab.allow_const_fn_ptr).unwrap_or(false) diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index b84ebd8afe885..1ae1f3440212d 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -2223,7 +2223,7 @@ impl<'tcx> Borrow<[Ty<'tcx>]> for Interned<'tcx, List>> { } impl<'tcx> Borrow<[CanonicalVarInfo]> for Interned<'tcx, List> { - fn borrow<'a>(&'a self) -> &'a [CanonicalVarInfo] { + fn borrow(&self) -> &[CanonicalVarInfo] { &self.0[..] } } @@ -2236,13 +2236,13 @@ impl<'tcx> Borrow<[Kind<'tcx>]> for Interned<'tcx, InternalSubsts<'tcx>> { impl<'tcx> Borrow<[ProjectionKind]> for Interned<'tcx, List> { - fn borrow<'a>(&'a self) -> &'a [ProjectionKind] { + fn borrow(&self) -> &[ProjectionKind] { &self.0[..] } } impl<'tcx> Borrow for Interned<'tcx, RegionKind> { - fn borrow<'a>(&'a self) -> &'a RegionKind { + fn borrow(&self) -> &RegionKind { &self.0 } } diff --git a/src/librustc/ty/fast_reject.rs b/src/librustc/ty/fast_reject.rs index 7aab1aef3b895..ee0d33dbe345c 100644 --- a/src/librustc/ty/fast_reject.rs +++ b/src/librustc/ty/fast_reject.rs @@ -55,8 +55,8 @@ pub enum SimplifiedTypeGen /// then we can't say much about whether two types would unify. Put another way, /// `can_simplify_params` should be true if type parameters appear free in `ty` and `false` if they /// are to be considered bound. -pub fn simplify_type<'tcx>( - tcx: TyCtxt<'tcx>, +pub fn simplify_type( + tcx: TyCtxt<'_>, ty: Ty<'_>, can_simplify_params: bool, ) -> Option { diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 361410380e8f8..22c2fd63b195a 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -213,7 +213,7 @@ impl AssocItem { } } - pub fn signature<'tcx>(&self, tcx: TyCtxt<'tcx>) -> String { + pub fn signature(&self, tcx: TyCtxt<'_>) -> String { match self.kind { ty::AssocKind::Method => { // We skip the binder here because the binder would deanonymize all @@ -2311,7 +2311,7 @@ impl<'tcx> AdtDef { /// Returns an iterator over all fields contained /// by this ADT. #[inline] - pub fn all_fields<'s>(&'s self) -> impl Iterator + Clone { + pub fn all_fields(&self) -> impl Iterator + Clone { self.variants.iter().flat_map(|v| v.fields.iter()) } @@ -3125,7 +3125,7 @@ impl Iterator for AssocItemsIterator<'_> { } } -fn associated_item<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> AssocItem { +fn associated_item(tcx: TyCtxt<'_>, def_id: DefId) -> AssocItem { let id = tcx.hir().as_local_hir_id(def_id).unwrap(); let parent_id = tcx.hir().get_parent_item(id); let parent_def_id = tcx.hir().local_def_id_from_hir_id(parent_id); @@ -3170,7 +3170,7 @@ pub struct AdtSizedConstraint<'tcx>(pub &'tcx [Ty<'tcx>]); /// such. /// - a Error, if a type contained itself. The representability /// check should catch this case. -fn adt_sized_constraint<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> AdtSizedConstraint<'tcx> { +fn adt_sized_constraint(tcx: TyCtxt<'_>, def_id: DefId) -> AdtSizedConstraint<'_> { let def = tcx.adt_def(def_id); let result = tcx.mk_type_list(def.variants.iter().flat_map(|v| { @@ -3184,7 +3184,7 @@ fn adt_sized_constraint<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> AdtSizedConst AdtSizedConstraint(result) } -fn associated_item_def_ids<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx [DefId] { +fn associated_item_def_ids(tcx: TyCtxt<'_>, def_id: DefId) -> &[DefId] { let id = tcx.hir().as_local_hir_id(def_id).unwrap(); let item = tcx.hir().expect_item(id); match item.node { @@ -3207,14 +3207,14 @@ fn associated_item_def_ids<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx [Def } } -fn def_span<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Span { +fn def_span(tcx: TyCtxt<'_>, def_id: DefId) -> Span { tcx.hir().span_if_local(def_id).unwrap() } /// If the given `DefId` describes an item belonging to a trait, /// returns the `DefId` of the trait that the trait item belongs to; /// otherwise, returns `None`. -fn trait_of_item<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Option { +fn trait_of_item(tcx: TyCtxt<'_>, def_id: DefId) -> Option { tcx.opt_associated_item(def_id) .and_then(|associated_item| { match associated_item.container { @@ -3237,7 +3237,7 @@ pub fn is_impl_trait_defn(tcx: TyCtxt<'_>, def_id: DefId) -> Option { } /// See `ParamEnv` struct definition for details. -fn param_env<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> ParamEnv<'tcx> { +fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ParamEnv<'_> { // The param_env of an impl Trait type is its defining function's param_env if let Some(parent) = is_impl_trait_defn(tcx, def_id) { return param_env(tcx, parent); @@ -3272,17 +3272,17 @@ fn param_env<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> ParamEnv<'tcx> { traits::normalize_param_env_or_error(tcx, def_id, unnormalized_env, cause) } -fn crate_disambiguator<'tcx>(tcx: TyCtxt<'tcx>, crate_num: CrateNum) -> CrateDisambiguator { +fn crate_disambiguator(tcx: TyCtxt<'_>, crate_num: CrateNum) -> CrateDisambiguator { assert_eq!(crate_num, LOCAL_CRATE); tcx.sess.local_crate_disambiguator() } -fn original_crate_name<'tcx>(tcx: TyCtxt<'tcx>, crate_num: CrateNum) -> Symbol { +fn original_crate_name(tcx: TyCtxt<'_>, crate_num: CrateNum) -> Symbol { assert_eq!(crate_num, LOCAL_CRATE); tcx.crate_name.clone() } -fn crate_hash<'tcx>(tcx: TyCtxt<'tcx>, crate_num: CrateNum) -> Svh { +fn crate_hash(tcx: TyCtxt<'_>, crate_num: CrateNum) -> Svh { assert_eq!(crate_num, LOCAL_CRATE); tcx.hir().crate_hash } @@ -3302,7 +3302,7 @@ fn instance_def_size_estimate<'tcx>(tcx: TyCtxt<'tcx>, instance_def: InstanceDef /// If `def_id` is an issue 33140 hack impl, returns its self type; otherwise, returns `None`. /// /// See [`ImplOverlapKind::Issue33140`] for more details. -fn issue33140_self_ty<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Option> { +fn issue33140_self_ty(tcx: TyCtxt<'_>, def_id: DefId) -> Option> { debug!("issue33140_self_ty({:?})", def_id); let trait_ref = tcx.impl_trait_ref(def_id).unwrap_or_else(|| { diff --git a/src/librustc/ty/trait_def.rs b/src/librustc/ty/trait_def.rs index c40d4d5b9cc35..a7ade875bf11b 100644 --- a/src/librustc/ty/trait_def.rs +++ b/src/librustc/ty/trait_def.rs @@ -150,10 +150,10 @@ impl<'tcx> TyCtxt<'tcx> { } // Query provider for `trait_impls_of`. -pub(super) fn trait_impls_of_provider<'tcx>( - tcx: TyCtxt<'tcx>, +pub(super) fn trait_impls_of_provider( + tcx: TyCtxt<'_>, trait_id: DefId, -) -> &'tcx TraitImpls { +) -> &TraitImpls { let mut impls = TraitImpls::default(); { diff --git a/src/librustc/ty/walk.rs b/src/librustc/ty/walk.rs index 234407a7c4eaf..c74511cf0fdda 100644 --- a/src/librustc/ty/walk.rs +++ b/src/librustc/ty/walk.rs @@ -56,7 +56,7 @@ impl<'tcx> Iterator for TypeWalker<'tcx> { } } -pub fn walk_shallow<'tcx>(ty: Ty<'tcx>) -> smallvec::IntoIter> { +pub fn walk_shallow(ty: Ty<'_>) -> smallvec::IntoIter> { let mut stack = SmallVec::new(); push_subtypes(&mut stack, ty); stack.into_iter()