Skip to content

Commit 64e5818

Browse files
authored
Rollup merge of #62019 - jeremystucki:refactoring, r=estebank
Remove needless lifetimes
2 parents 595f55c + 004efa2 commit 64e5818

File tree

6 files changed

+25
-25
lines changed

6 files changed

+25
-25
lines changed

Diff for: src/librustc/ty/constness.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ impl<'tcx> TyCtxt<'tcx> {
6767
}
6868

6969

70-
pub fn provide<'tcx>(providers: &mut Providers<'tcx>) {
70+
pub fn provide(providers: &mut Providers<'_>) {
7171
/// only checks whether the function has a `const` modifier
72-
fn is_const_fn_raw<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> bool {
72+
fn is_const_fn_raw(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
7373
let hir_id = tcx.hir().as_local_hir_id(def_id)
7474
.expect("Non-local call to local provider is_const_fn");
7575

@@ -83,7 +83,7 @@ pub fn provide<'tcx>(providers: &mut Providers<'tcx>) {
8383
}
8484
}
8585

86-
fn is_promotable_const_fn<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> bool {
86+
fn is_promotable_const_fn(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
8787
tcx.is_const_fn(def_id) && match tcx.lookup_stability(def_id) {
8888
Some(stab) => {
8989
if cfg!(debug_assertions) && stab.promotable {
@@ -101,7 +101,7 @@ pub fn provide<'tcx>(providers: &mut Providers<'tcx>) {
101101
}
102102
}
103103

104-
fn const_fn_is_allowed_fn_ptr<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> bool {
104+
fn const_fn_is_allowed_fn_ptr(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
105105
tcx.is_const_fn(def_id) &&
106106
tcx.lookup_stability(def_id)
107107
.map(|stab| stab.allow_const_fn_ptr).unwrap_or(false)

Diff for: src/librustc/ty/context.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2223,7 +2223,7 @@ impl<'tcx> Borrow<[Ty<'tcx>]> for Interned<'tcx, List<Ty<'tcx>>> {
22232223
}
22242224

22252225
impl<'tcx> Borrow<[CanonicalVarInfo]> for Interned<'tcx, List<CanonicalVarInfo>> {
2226-
fn borrow<'a>(&'a self) -> &'a [CanonicalVarInfo] {
2226+
fn borrow(&self) -> &[CanonicalVarInfo] {
22272227
&self.0[..]
22282228
}
22292229
}
@@ -2236,13 +2236,13 @@ impl<'tcx> Borrow<[Kind<'tcx>]> for Interned<'tcx, InternalSubsts<'tcx>> {
22362236

22372237
impl<'tcx> Borrow<[ProjectionKind]>
22382238
for Interned<'tcx, List<ProjectionKind>> {
2239-
fn borrow<'a>(&'a self) -> &'a [ProjectionKind] {
2239+
fn borrow(&self) -> &[ProjectionKind] {
22402240
&self.0[..]
22412241
}
22422242
}
22432243

22442244
impl<'tcx> Borrow<RegionKind> for Interned<'tcx, RegionKind> {
2245-
fn borrow<'a>(&'a self) -> &'a RegionKind {
2245+
fn borrow(&self) -> &RegionKind {
22462246
&self.0
22472247
}
22482248
}

Diff for: src/librustc/ty/fast_reject.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ pub enum SimplifiedTypeGen<D>
5555
/// then we can't say much about whether two types would unify. Put another way,
5656
/// `can_simplify_params` should be true if type parameters appear free in `ty` and `false` if they
5757
/// are to be considered bound.
58-
pub fn simplify_type<'tcx>(
59-
tcx: TyCtxt<'tcx>,
58+
pub fn simplify_type(
59+
tcx: TyCtxt<'_>,
6060
ty: Ty<'_>,
6161
can_simplify_params: bool,
6262
) -> Option<SimplifiedType> {

Diff for: src/librustc/ty/mod.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ impl AssocItem {
213213
}
214214
}
215215

216-
pub fn signature<'tcx>(&self, tcx: TyCtxt<'tcx>) -> String {
216+
pub fn signature(&self, tcx: TyCtxt<'_>) -> String {
217217
match self.kind {
218218
ty::AssocKind::Method => {
219219
// We skip the binder here because the binder would deanonymize all
@@ -2311,7 +2311,7 @@ impl<'tcx> AdtDef {
23112311
/// Returns an iterator over all fields contained
23122312
/// by this ADT.
23132313
#[inline]
2314-
pub fn all_fields<'s>(&'s self) -> impl Iterator<Item = &'s FieldDef> + Clone {
2314+
pub fn all_fields(&self) -> impl Iterator<Item=&FieldDef> + Clone {
23152315
self.variants.iter().flat_map(|v| v.fields.iter())
23162316
}
23172317

@@ -3111,7 +3111,7 @@ impl Iterator for AssocItemsIterator<'_> {
31113111
}
31123112
}
31133113

3114-
fn associated_item<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> AssocItem {
3114+
fn associated_item(tcx: TyCtxt<'_>, def_id: DefId) -> AssocItem {
31153115
let id = tcx.hir().as_local_hir_id(def_id).unwrap();
31163116
let parent_id = tcx.hir().get_parent_item(id);
31173117
let parent_def_id = tcx.hir().local_def_id_from_hir_id(parent_id);
@@ -3156,7 +3156,7 @@ pub struct AdtSizedConstraint<'tcx>(pub &'tcx [Ty<'tcx>]);
31563156
/// such.
31573157
/// - a Error, if a type contained itself. The representability
31583158
/// check should catch this case.
3159-
fn adt_sized_constraint<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> AdtSizedConstraint<'tcx> {
3159+
fn adt_sized_constraint(tcx: TyCtxt<'_>, def_id: DefId) -> AdtSizedConstraint<'_> {
31603160
let def = tcx.adt_def(def_id);
31613161

31623162
let result = tcx.mk_type_list(def.variants.iter().flat_map(|v| {
@@ -3170,7 +3170,7 @@ fn adt_sized_constraint<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> AdtSizedConst
31703170
AdtSizedConstraint(result)
31713171
}
31723172

3173-
fn associated_item_def_ids<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx [DefId] {
3173+
fn associated_item_def_ids(tcx: TyCtxt<'_>, def_id: DefId) -> &[DefId] {
31743174
let id = tcx.hir().as_local_hir_id(def_id).unwrap();
31753175
let item = tcx.hir().expect_item(id);
31763176
match item.node {
@@ -3193,14 +3193,14 @@ fn associated_item_def_ids<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx [Def
31933193
}
31943194
}
31953195

3196-
fn def_span<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Span {
3196+
fn def_span(tcx: TyCtxt<'_>, def_id: DefId) -> Span {
31973197
tcx.hir().span_if_local(def_id).unwrap()
31983198
}
31993199

32003200
/// If the given `DefId` describes an item belonging to a trait,
32013201
/// returns the `DefId` of the trait that the trait item belongs to;
32023202
/// otherwise, returns `None`.
3203-
fn trait_of_item<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Option<DefId> {
3203+
fn trait_of_item(tcx: TyCtxt<'_>, def_id: DefId) -> Option<DefId> {
32043204
tcx.opt_associated_item(def_id)
32053205
.and_then(|associated_item| {
32063206
match associated_item.container {
@@ -3223,7 +3223,7 @@ pub fn is_impl_trait_defn(tcx: TyCtxt<'_>, def_id: DefId) -> Option<DefId> {
32233223
}
32243224

32253225
/// See `ParamEnv` struct definition for details.
3226-
fn param_env<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> ParamEnv<'tcx> {
3226+
fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ParamEnv<'_> {
32273227
// The param_env of an impl Trait type is its defining function's param_env
32283228
if let Some(parent) = is_impl_trait_defn(tcx, def_id) {
32293229
return param_env(tcx, parent);
@@ -3258,17 +3258,17 @@ fn param_env<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> ParamEnv<'tcx> {
32583258
traits::normalize_param_env_or_error(tcx, def_id, unnormalized_env, cause)
32593259
}
32603260

3261-
fn crate_disambiguator<'tcx>(tcx: TyCtxt<'tcx>, crate_num: CrateNum) -> CrateDisambiguator {
3261+
fn crate_disambiguator(tcx: TyCtxt<'_>, crate_num: CrateNum) -> CrateDisambiguator {
32623262
assert_eq!(crate_num, LOCAL_CRATE);
32633263
tcx.sess.local_crate_disambiguator()
32643264
}
32653265

3266-
fn original_crate_name<'tcx>(tcx: TyCtxt<'tcx>, crate_num: CrateNum) -> Symbol {
3266+
fn original_crate_name(tcx: TyCtxt<'_>, crate_num: CrateNum) -> Symbol {
32673267
assert_eq!(crate_num, LOCAL_CRATE);
32683268
tcx.crate_name.clone()
32693269
}
32703270

3271-
fn crate_hash<'tcx>(tcx: TyCtxt<'tcx>, crate_num: CrateNum) -> Svh {
3271+
fn crate_hash(tcx: TyCtxt<'_>, crate_num: CrateNum) -> Svh {
32723272
assert_eq!(crate_num, LOCAL_CRATE);
32733273
tcx.hir().crate_hash
32743274
}
@@ -3288,7 +3288,7 @@ fn instance_def_size_estimate<'tcx>(tcx: TyCtxt<'tcx>, instance_def: InstanceDef
32883288
/// If `def_id` is an issue 33140 hack impl, returns its self type; otherwise, returns `None`.
32893289
///
32903290
/// See [`ImplOverlapKind::Issue33140`] for more details.
3291-
fn issue33140_self_ty<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Option<Ty<'tcx>> {
3291+
fn issue33140_self_ty(tcx: TyCtxt<'_>, def_id: DefId) -> Option<Ty<'_>> {
32923292
debug!("issue33140_self_ty({:?})", def_id);
32933293

32943294
let trait_ref = tcx.impl_trait_ref(def_id).unwrap_or_else(|| {

Diff for: src/librustc/ty/trait_def.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ impl<'tcx> TyCtxt<'tcx> {
150150
}
151151

152152
// Query provider for `trait_impls_of`.
153-
pub(super) fn trait_impls_of_provider<'tcx>(
154-
tcx: TyCtxt<'tcx>,
153+
pub(super) fn trait_impls_of_provider(
154+
tcx: TyCtxt<'_>,
155155
trait_id: DefId,
156-
) -> &'tcx TraitImpls {
156+
) -> &TraitImpls {
157157
let mut impls = TraitImpls::default();
158158

159159
{

Diff for: src/librustc/ty/walk.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl<'tcx> Iterator for TypeWalker<'tcx> {
5656
}
5757
}
5858

59-
pub fn walk_shallow<'tcx>(ty: Ty<'tcx>) -> smallvec::IntoIter<TypeWalkerArray<'tcx>> {
59+
pub fn walk_shallow(ty: Ty<'_>) -> smallvec::IntoIter<TypeWalkerArray<'_>> {
6060
let mut stack = SmallVec::new();
6161
push_subtypes(&mut stack, ty);
6262
stack.into_iter()

0 commit comments

Comments
 (0)