Skip to content

Commit c13548d

Browse files
authored
Rollup merge of #69809 - matthiaskrgr:lifetimes, r=eddyb
remove lifetimes that can be elided (clippy::needless_lifetimes)
2 parents 8e17c83 + 7b1b08c commit c13548d

File tree

32 files changed

+50
-50
lines changed

32 files changed

+50
-50
lines changed

src/liballoc/collections/linked_list.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1427,7 +1427,7 @@ impl<'a, T> CursorMut<'a, T> {
14271427
/// `CursorMut`, which means it cannot outlive the `CursorMut` and that the
14281428
/// `CursorMut` is frozen for the lifetime of the `Cursor`.
14291429
#[unstable(feature = "linked_list_cursors", issue = "58533")]
1430-
pub fn as_cursor<'cm>(&'cm self) -> Cursor<'cm, T> {
1430+
pub fn as_cursor(&self) -> Cursor<'_, T> {
14311431
Cursor { list: self.list, current: self.current, index: self.index }
14321432
}
14331433
}

src/librustc/dep_graph/dep_node.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ macro_rules! define_dep_nodes {
179179
$(
180180
#[inline(always)]
181181
#[allow(unreachable_code, non_snake_case)]
182-
pub fn $variant<'tcx>(_tcx: TyCtxt<'tcx>, $(arg: $tuple_arg_ty)*) -> DepNode {
182+
pub fn $variant(_tcx: TyCtxt<'_>, $(arg: $tuple_arg_ty)*) -> DepNode {
183183
// tuple args
184184
$({
185185
erase!($tuple_arg_ty);

src/librustc/hir/map/collector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
340340
/// deep walking so that we walk nested items in the context of
341341
/// their outer items.
342342
343-
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Self::Map> {
343+
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
344344
panic!("`visit_nested_xxx` must be manually implemented in this visitor");
345345
}
346346

src/librustc/hir/map/hir_id_validator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl<'a, 'hir> HirIdValidator<'a, 'hir> {
135135
impl<'a, 'hir> intravisit::Visitor<'hir> for HirIdValidator<'a, 'hir> {
136136
type Map = Map<'hir>;
137137

138-
fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, Self::Map> {
138+
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<'_, Self::Map> {
139139
intravisit::NestedVisitorMap::OnlyBodies(self.hir_map)
140140
}
141141

src/librustc/mir/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ pub enum ClearCrossCrate<T> {
403403
}
404404

405405
impl<T> ClearCrossCrate<T> {
406-
pub fn as_ref(&'a self) -> ClearCrossCrate<&'a T> {
406+
pub fn as_ref(&self) -> ClearCrossCrate<&T> {
407407
match self {
408408
ClearCrossCrate::Clear => ClearCrossCrate::Clear,
409409
ClearCrossCrate::Set(v) => ClearCrossCrate::Set(v),
@@ -2503,7 +2503,7 @@ impl UserTypeProjection {
25032503

25042504
pub(crate) fn variant(
25052505
mut self,
2506-
adt_def: &'tcx AdtDef,
2506+
adt_def: &AdtDef,
25072507
variant_index: VariantIdx,
25082508
field: Field,
25092509
) -> Self {

src/librustc_codegen_llvm/common.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> {
320320
}
321321
}
322322

323-
pub fn val_ty(v: &'ll Value) -> &'ll Type {
323+
pub fn val_ty(v: &Value) -> &Type {
324324
unsafe { llvm::LLVMTypeOf(v) }
325325
}
326326

@@ -342,6 +342,6 @@ fn hi_lo_to_u128(lo: u64, hi: u64) -> u128 {
342342
((hi as u128) << 64) | (lo as u128)
343343
}
344344

345-
fn try_as_const_integral(v: &'ll Value) -> Option<&'ll ConstantInt> {
345+
fn try_as_const_integral(v: &Value) -> Option<&ConstantInt> {
346346
unsafe { llvm::LLVMIsAConstantInt(v) }
347347
}

src/librustc_codegen_llvm/llvm/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,12 @@ impl Drop for SectionIter<'a> {
185185
}
186186
}
187187

188-
pub fn mk_section_iter(llof: &'a ffi::ObjectFile) -> SectionIter<'a> {
188+
pub fn mk_section_iter(llof: &ffi::ObjectFile) -> SectionIter<'_> {
189189
unsafe { SectionIter { llsi: LLVMGetSections(llof) } }
190190
}
191191

192192
/// Safe wrapper around `LLVMGetParam`, because segfaults are no fun.
193-
pub fn get_param(llfn: &'a Value, index: c_uint) -> &'a Value {
193+
pub fn get_param(llfn: &Value, index: c_uint) -> &Value {
194194
unsafe {
195195
assert!(
196196
index < LLVMCountParams(llfn),
@@ -203,7 +203,7 @@ pub fn get_param(llfn: &'a Value, index: c_uint) -> &'a Value {
203203
}
204204

205205
/// Safe wrapper for `LLVMGetValueName2` into a byte slice
206-
pub fn get_value_name(value: &'a Value) -> &'a [u8] {
206+
pub fn get_value_name(value: &Value) -> &[u8] {
207207
unsafe {
208208
let mut len = 0;
209209
let data = LLVMGetValueName2(value, &mut len);

src/librustc_codegen_llvm/type_.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ impl Type {
240240
unsafe { llvm::LLVMIntTypeInContext(llcx, num_bits as c_uint) }
241241
}
242242

243-
pub fn i8p_llcx(llcx: &'ll llvm::Context) -> &'ll Type {
243+
pub fn i8p_llcx(llcx: &llvm::Context) -> &Type {
244244
Type::i8_llcx(llcx).ptr_to()
245245
}
246246

src/librustc_data_structures/graph/scc/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl<N: Idx, S: Idx> GraphSuccessors<'graph> for Sccs<N, S> {
9797
}
9898

9999
impl<N: Idx, S: Idx> WithSuccessors for Sccs<N, S> {
100-
fn successors<'graph>(&'graph self, node: S) -> <Self as GraphSuccessors<'graph>>::Iter {
100+
fn successors(&self, node: S) -> <Self as GraphSuccessors<'_>>::Iter {
101101
self.successors(node).iter().cloned()
102102
}
103103
}

src/librustc_data_structures/graph/vec_graph/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl<N: Idx> GraphSuccessors<'graph> for VecGraph<N> {
101101
}
102102

103103
impl<N: Idx> WithSuccessors for VecGraph<N> {
104-
fn successors<'graph>(&'graph self, node: N) -> <Self as GraphSuccessors<'graph>>::Iter {
104+
fn successors(&self, node: N) -> <Self as GraphSuccessors<'_>>::Iter {
105105
self.successors(node).iter().cloned()
106106
}
107107
}

src/librustc_driver/pretty.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ trait PrinterSupport: pprust::PpAnn {
9696
///
9797
/// (Rust does not yet support upcasting from a trait object to
9898
/// an object for one of its super-traits.)
99-
fn pp_ann<'a>(&'a self) -> &'a dyn pprust::PpAnn;
99+
fn pp_ann(&self) -> &dyn pprust::PpAnn;
100100
}
101101

102102
trait HirPrinterSupport<'hir>: pprust_hir::PpAnn {
@@ -106,13 +106,13 @@ trait HirPrinterSupport<'hir>: pprust_hir::PpAnn {
106106

107107
/// Provides a uniform interface for re-extracting a reference to an
108108
/// `hir_map::Map` from a value that now owns it.
109-
fn hir_map<'a>(&'a self) -> Option<&'a hir_map::Map<'hir>>;
109+
fn hir_map(&self) -> Option<&hir_map::Map<'hir>>;
110110

111111
/// Produces the pretty-print annotation object.
112112
///
113113
/// (Rust does not yet support upcasting from a trait object to
114114
/// an object for one of its super-traits.)
115-
fn pp_ann<'a>(&'a self) -> &'a dyn pprust_hir::PpAnn;
115+
fn pp_ann(&self) -> &dyn pprust_hir::PpAnn;
116116

117117
/// Computes an user-readable representation of a path, if possible.
118118
fn node_path(&self, id: hir::HirId) -> Option<String> {
@@ -132,7 +132,7 @@ impl<'hir> PrinterSupport for NoAnn<'hir> {
132132
self.sess
133133
}
134134

135-
fn pp_ann<'a>(&'a self) -> &'a dyn pprust::PpAnn {
135+
fn pp_ann(&self) -> &dyn pprust::PpAnn {
136136
self
137137
}
138138
}
@@ -142,11 +142,11 @@ impl<'hir> HirPrinterSupport<'hir> for NoAnn<'hir> {
142142
self.sess
143143
}
144144

145-
fn hir_map<'a>(&'a self) -> Option<&'a hir_map::Map<'hir>> {
145+
fn hir_map(&self) -> Option<&hir_map::Map<'hir>> {
146146
self.tcx.map(|tcx| *tcx.hir())
147147
}
148148

149-
fn pp_ann<'a>(&'a self) -> &'a dyn pprust_hir::PpAnn {
149+
fn pp_ann(&self) -> &dyn pprust_hir::PpAnn {
150150
self
151151
}
152152
}
@@ -170,7 +170,7 @@ impl<'hir> PrinterSupport for IdentifiedAnnotation<'hir> {
170170
self.sess
171171
}
172172

173-
fn pp_ann<'a>(&'a self) -> &'a dyn pprust::PpAnn {
173+
fn pp_ann(&self) -> &dyn pprust::PpAnn {
174174
self
175175
}
176176
}
@@ -216,11 +216,11 @@ impl<'hir> HirPrinterSupport<'hir> for IdentifiedAnnotation<'hir> {
216216
self.sess
217217
}
218218

219-
fn hir_map<'a>(&'a self) -> Option<&'a hir_map::Map<'hir>> {
219+
fn hir_map(&self) -> Option<&hir_map::Map<'hir>> {
220220
self.tcx.map(|tcx| *tcx.hir())
221221
}
222222

223-
fn pp_ann<'a>(&'a self) -> &'a dyn pprust_hir::PpAnn {
223+
fn pp_ann(&self) -> &dyn pprust_hir::PpAnn {
224224
self
225225
}
226226
}
@@ -315,11 +315,11 @@ impl<'b, 'tcx> HirPrinterSupport<'tcx> for TypedAnnotation<'b, 'tcx> {
315315
&self.tcx.sess
316316
}
317317

318-
fn hir_map<'a>(&'a self) -> Option<&'a hir_map::Map<'tcx>> {
318+
fn hir_map(&self) -> Option<&hir_map::Map<'tcx>> {
319319
Some(&self.tcx.hir())
320320
}
321321

322-
fn pp_ann<'a>(&'a self) -> &'a dyn pprust_hir::PpAnn {
322+
fn pp_ann(&self) -> &dyn pprust_hir::PpAnn {
323323
self
324324
}
325325

src/librustc_hir/intravisit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ pub trait Visitor<'v>: Sized {
284284
/// If you use this, you probably don't want to process the
285285
/// contents of nested item-like things, since the outer loop will
286286
/// visit them as well.
287-
fn as_deep_visitor<'s>(&'s mut self) -> DeepVisitor<'s, Self> {
287+
fn as_deep_visitor(&mut self) -> DeepVisitor<'_, Self> {
288288
DeepVisitor::new(self)
289289
}
290290

src/librustc_incremental/assert_dep_graph.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ impl IfThisChanged<'tcx> {
162162
impl Visitor<'tcx> for IfThisChanged<'tcx> {
163163
type Map = Map<'tcx>;
164164

165-
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Self::Map> {
165+
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
166166
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
167167
}
168168

src/librustc_incremental/persist/dirty_clean.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ impl FindAllAttrs<'tcx> {
548548
impl intravisit::Visitor<'tcx> for FindAllAttrs<'tcx> {
549549
type Map = Map<'tcx>;
550550

551-
fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, Self::Map> {
551+
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<'_, Self::Map> {
552552
intravisit::NestedVisitorMap::All(&self.tcx.hir())
553553
}
554554

src/librustc_infer/infer/error_reporting/need_type_info.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ impl<'a, 'tcx> FindLocalByTypeVisitor<'a, 'tcx> {
6969
impl<'a, 'tcx> Visitor<'tcx> for FindLocalByTypeVisitor<'a, 'tcx> {
7070
type Map = Map<'tcx>;
7171

72-
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Self::Map> {
72+
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
7373
NestedVisitorMap::OnlyBodies(&self.hir_map)
7474
}
7575

src/librustc_infer/infer/error_reporting/nice_region_error/find_anon_type.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ struct FindNestedTypeVisitor<'tcx> {
9393
impl Visitor<'tcx> for FindNestedTypeVisitor<'tcx> {
9494
type Map = Map<'tcx>;
9595

96-
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Self::Map> {
96+
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
9797
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
9898
}
9999

src/librustc_infer/traits/coherence.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ fn def_id_is_local(def_id: DefId, in_crate: InCrate) -> bool {
451451
}
452452
}
453453

454-
fn ty_is_non_local_constructor<'tcx>(ty: Ty<'tcx>, in_crate: InCrate) -> Option<Ty<'tcx>> {
454+
fn ty_is_non_local_constructor(ty: Ty<'_>, in_crate: InCrate) -> Option<Ty<'_>> {
455455
debug!("ty_is_non_local_constructor({:?})", ty);
456456

457457
match ty.kind {

src/librustc_lint/late.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use std::slice;
3333

3434
/// Extract the `LintStore` from the query context.
3535
/// This function exists because we've erased `LintStore` as `dyn Any` in the context.
36-
crate fn unerased_lint_store<'tcx>(tcx: TyCtxt<'tcx>) -> &'tcx LintStore {
36+
crate fn unerased_lint_store(tcx: TyCtxt<'_>) -> &LintStore {
3737
let store: &dyn Any = &*tcx.lint_store;
3838
store.downcast_ref().unwrap()
3939
}
@@ -99,7 +99,7 @@ impl<'a, 'tcx, T: LateLintPass<'a, 'tcx>> hir_visit::Visitor<'tcx>
9999
/// Because lints are scoped lexically, we want to walk nested
100100
/// items in the context of the outer item, so enable
101101
/// deep-walking.
102-
fn nested_visit_map<'this>(&'this mut self) -> hir_visit::NestedVisitorMap<'this, Self::Map> {
102+
fn nested_visit_map(&mut self) -> hir_visit::NestedVisitorMap<'_, Self::Map> {
103103
hir_visit::NestedVisitorMap::All(&self.context.tcx.hir())
104104
}
105105

src/librustc_lint/levels.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ impl LintLevelMapBuilder<'_, '_> {
438438
impl<'tcx> intravisit::Visitor<'tcx> for LintLevelMapBuilder<'_, 'tcx> {
439439
type Map = Map<'tcx>;
440440

441-
fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, Self::Map> {
441+
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<'_, Self::Map> {
442442
intravisit::NestedVisitorMap::All(&self.tcx.hir())
443443
}
444444

src/librustc_mir/const_eval/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub(crate) fn const_field<'tcx>(
4343
op_to_const(&ecx, field)
4444
}
4545

46-
pub(crate) fn const_caller_location<'tcx>(
46+
pub(crate) fn const_caller_location(
4747
tcx: TyCtxt<'tcx>,
4848
(file, line, col): (Symbol, u32, u32),
4949
) -> ConstValue<'tcx> {

src/librustc_mir/transform/add_retag.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn is_stable(place: PlaceRef<'_>) -> bool {
3434
}
3535

3636
/// Determine whether this type may be a reference (or box), and thus needs retagging.
37-
fn may_be_reference<'tcx>(ty: Ty<'tcx>) -> bool {
37+
fn may_be_reference(ty: Ty<'tcx>) -> bool {
3838
match ty.kind {
3939
// Primitive types that are not references
4040
ty::Bool

src/librustc_mir/transform/check_unsafety.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ struct UnusedUnsafeVisitor<'a> {
453453
impl<'a, 'tcx> intravisit::Visitor<'tcx> for UnusedUnsafeVisitor<'a> {
454454
type Map = Map<'tcx>;
455455

456-
fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, Self::Map> {
456+
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<'_, Self::Map> {
457457
intravisit::NestedVisitorMap::None
458458
}
459459

src/librustc_mir/transform/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ fn mir_keys(tcx: TyCtxt<'_>, krate: CrateNum) -> &DefIdSet {
8787
intravisit::walk_struct_def(self, v)
8888
}
8989
type Map = Map<'tcx>;
90-
fn nested_visit_map<'b>(&'b mut self) -> NestedVisitorMap<'b, Self::Map> {
90+
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
9191
NestedVisitorMap::None
9292
}
9393
}

src/librustc_parse/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,11 @@ pub fn stream_to_parser<'a>(
271271
/// The main usage of this function is outside of rustc, for those who uses
272272
/// librustc_ast as a library. Please do not remove this function while refactoring
273273
/// just because it is not used in rustc codebase!
274-
pub fn stream_to_parser_with_base_dir<'a>(
275-
sess: &'a ParseSess,
274+
pub fn stream_to_parser_with_base_dir(
275+
sess: &ParseSess,
276276
stream: TokenStream,
277277
base_dir: Directory,
278-
) -> Parser<'a> {
278+
) -> Parser<'_> {
279279
Parser::new(sess, stream, Some(base_dir), true, false, None)
280280
}
281281

src/librustc_passes/check_attr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ impl CheckAttrVisitor<'tcx> {
418418
impl Visitor<'tcx> for CheckAttrVisitor<'tcx> {
419419
type Map = Map<'tcx>;
420420

421-
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Self::Map> {
421+
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
422422
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
423423
}
424424

src/librustc_passes/lang_items.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ impl LanguageItemCollector<'tcx> {
143143
}
144144

145145
/// Traverses and collects all the lang items in all crates.
146-
fn collect<'tcx>(tcx: TyCtxt<'tcx>) -> LanguageItems {
146+
fn collect(tcx: TyCtxt<'_>) -> LanguageItems {
147147
// Initialize the collector.
148148
let mut collector = LanguageItemCollector::new(tcx);
149149

src/librustc_passes/upvars.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ struct LocalCollector {
4646
impl Visitor<'tcx> for LocalCollector {
4747
type Map = Map<'tcx>;
4848

49-
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Self::Map> {
49+
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
5050
NestedVisitorMap::None
5151
}
5252

@@ -75,7 +75,7 @@ impl CaptureCollector<'_, '_> {
7575
impl Visitor<'tcx> for CaptureCollector<'a, 'tcx> {
7676
type Map = Map<'tcx>;
7777

78-
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Self::Map> {
78+
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
7979
NestedVisitorMap::None
8080
}
8181

src/librustc_traits/lowering/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ impl ClauseDumper<'tcx> {
603603
impl Visitor<'tcx> for ClauseDumper<'tcx> {
604604
type Map = Map<'tcx>;
605605

606-
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Self::Map> {
606+
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
607607
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
608608
}
609609

src/librustc_ty/ty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ fn associated_item_def_ids(tcx: TyCtxt<'_>, def_id: DefId) -> &[DefId] {
210210
}
211211
}
212212

213-
fn associated_items<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx ty::AssociatedItems {
213+
fn associated_items(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::AssociatedItems {
214214
let items = tcx.associated_item_def_ids(def_id).iter().map(|did| tcx.associated_item(*did));
215215
tcx.arena.alloc(ty::AssociatedItems::new(items))
216216
}

0 commit comments

Comments
 (0)