Skip to content

Commit 2970a13

Browse files
authored
Rollup merge of rust-lang#62039 - jeremystucki:needless_lifetimes, r=eddyb
Remove needless lifetimes (rustc)
2 parents 088b987 + 88c515d commit 2970a13

File tree

128 files changed

+440
-440
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+440
-440
lines changed

src/libproc_macro/bridge/scoped_cell.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl<T: LambdaL> ScopedCell<T> {
7474
}
7575

7676
/// Sets the value in `self` to `value` while running `f`.
77-
pub fn set<'a, R>(&self, value: <T as ApplyL<'a>>::Out, f: impl FnOnce() -> R) -> R {
77+
pub fn set<R>(&self, value: <T as ApplyL<'_>>::Out, f: impl FnOnce() -> R) -> R {
7878
self.replace(value, |_| f())
7979
}
8080
}

src/librustc/cfg/construct.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct LoopScope {
3030
break_index: CFGIndex, // where to go on a `break`
3131
}
3232

33-
pub fn construct<'tcx>(tcx: TyCtxt<'tcx>, body: &hir::Body) -> CFG {
33+
pub fn construct(tcx: TyCtxt<'_>, body: &hir::Body) -> CFG {
3434
let mut graph = graph::Graph::new();
3535
let entry = graph.add_node(CFGNodeData::Entry);
3636

src/librustc/cfg/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub type CFGNode = graph::Node<CFGNodeData>;
4949
pub type CFGEdge = graph::Edge<CFGEdgeData>;
5050

5151
impl CFG {
52-
pub fn new<'tcx>(tcx: TyCtxt<'tcx>, body: &hir::Body) -> CFG {
52+
pub fn new(tcx: TyCtxt<'_>, body: &hir::Body) -> CFG {
5353
construct::construct(tcx, body)
5454
}
5555

src/librustc/dep_graph/graph.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ impl DepGraph {
841841
//
842842
// This method will only load queries that will end up in the disk cache.
843843
// Other queries will not be executed.
844-
pub fn exec_cache_promotions<'tcx>(&self, tcx: TyCtxt<'tcx>) {
844+
pub fn exec_cache_promotions(&self, tcx: TyCtxt<'_>) {
845845
let data = self.data.as_ref().unwrap();
846846
for prev_index in data.colors.values.indices() {
847847
match data.colors.get(prev_index) {

src/librustc/hir/check_attr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ fn is_c_like_enum(item: &hir::Item) -> bool {
347347
}
348348
}
349349

350-
fn check_mod_attrs<'tcx>(tcx: TyCtxt<'tcx>, module_def_id: DefId) {
350+
fn check_mod_attrs(tcx: TyCtxt<'_>, module_def_id: DefId) {
351351
tcx.hir().visit_item_likes_in_module(
352352
module_def_id,
353353
&mut CheckAttrVisitor { tcx }.as_deep_visitor()

src/librustc/hir/map/hir_id_validator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::hir::itemlikevisit::ItemLikeVisitor;
44
use rustc_data_structures::fx::FxHashSet;
55
use rustc_data_structures::sync::{Lock, ParallelIterator, par_iter};
66

7-
pub fn check_crate<'hir>(hir_map: &hir::map::Map<'hir>) {
7+
pub fn check_crate(hir_map: &hir::map::Map<'_>) {
88
hir_map.dep_graph.assert_ignored();
99

1010
let errors = Lock::new(Vec::new());

src/librustc/hir/map/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,15 @@ impl Forest {
147147
}
148148
}
149149

150-
pub fn krate<'hir>(&'hir self) -> &'hir Crate {
150+
pub fn krate(&self) -> &Crate {
151151
self.dep_graph.read(DepNode::new_no_params(DepKind::Krate));
152152
&self.krate
153153
}
154154

155155
/// This is used internally in the dependency tracking system.
156156
/// Use the `krate` method to ensure your dependency on the
157157
/// crate is tracked.
158-
pub fn untracked_krate<'hir>(&'hir self) -> &'hir Crate {
158+
pub fn untracked_krate(&self) -> &Crate {
159159
&self.krate
160160
}
161161
}
@@ -1085,7 +1085,7 @@ impl<'a> NodesMatchingSuffix<'a> {
10851085
// If `id` itself is a mod named `m` with parent `p`, then
10861086
// returns `Some(id, m, p)`. If `id` has no mod in its parent
10871087
// chain, then returns `None`.
1088-
fn find_first_mod_parent<'a>(map: &'a Map<'_>, mut id: HirId) -> Option<(HirId, Name)> {
1088+
fn find_first_mod_parent(map: &Map<'_>, mut id: HirId) -> Option<(HirId, Name)> {
10891089
loop {
10901090
if let Node::Item(item) = map.find(id)? {
10911091
if item_is_mod(&item) {

src/librustc/infer/type_variable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ impl<'tcx> TypeVariableTable<'tcx> {
115115
///
116116
/// Note that this function does not return care whether
117117
/// `vid` has been unified with something else or not.
118-
pub fn var_diverges<'a>(&'a self, vid: ty::TyVid) -> bool {
118+
pub fn var_diverges(&self, vid: ty::TyVid) -> bool {
119119
self.values.get(vid.index as usize).diverging
120120
}
121121

src/librustc/lint/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ pub fn maybe_lint_level_root(tcx: TyCtxt<'_>, id: hir::HirId) -> bool {
765765
attrs.iter().any(|attr| Level::from_symbol(attr.name_or_empty()).is_some())
766766
}
767767

768-
fn lint_levels<'tcx>(tcx: TyCtxt<'tcx>, cnum: CrateNum) -> &'tcx LintLevelMap {
768+
fn lint_levels(tcx: TyCtxt<'_>, cnum: CrateNum) -> &LintLevelMap {
769769
assert_eq!(cnum, LOCAL_CRATE);
770770
let mut builder = LintLevelMapBuilder {
771771
levels: LintLevelSets::builder(tcx.sess),

src/librustc/middle/cstore.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ pub trait CrateStore {
211211
fn crates_untracked(&self) -> Vec<CrateNum>;
212212

213213
// utility functions
214-
fn encode_metadata<'tcx>(&self, tcx: TyCtxt<'tcx>) -> EncodedMetadata;
214+
fn encode_metadata(&self, tcx: TyCtxt<'_>) -> EncodedMetadata;
215215
fn metadata_encoding_version(&self) -> &[u8];
216216
}
217217

src/librustc/middle/dead.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use syntax_pos;
2626
// explored. For example, if it's a live Node::Item that is a
2727
// function, then we should explore its block to check for codes that
2828
// may need to be marked as live.
29-
fn should_explore<'tcx>(tcx: TyCtxt<'tcx>, hir_id: hir::HirId) -> bool {
29+
fn should_explore(tcx: TyCtxt<'_>, hir_id: hir::HirId) -> bool {
3030
match tcx.hir().find(hir_id) {
3131
Some(Node::Item(..)) |
3232
Some(Node::ImplItem(..)) |
@@ -662,7 +662,7 @@ impl Visitor<'tcx> for DeadVisitor<'tcx> {
662662
}
663663
}
664664

665-
pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx>) {
665+
pub fn check_crate(tcx: TyCtxt<'_>) {
666666
let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE);
667667
let krate = tcx.hir().krate();
668668
let live_symbols = find_live(tcx, access_levels, krate);

src/librustc/middle/dependency_format.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub enum Linkage {
8181
Dynamic,
8282
}
8383

84-
pub fn calculate<'tcx>(tcx: TyCtxt<'tcx>) {
84+
pub fn calculate(tcx: TyCtxt<'_>) {
8585
let sess = &tcx.sess;
8686
let fmts = sess.crate_types.borrow().iter().map(|&ty| {
8787
let linkage = calculate_type(tcx, ty);
@@ -92,7 +92,7 @@ pub fn calculate<'tcx>(tcx: TyCtxt<'tcx>) {
9292
sess.dependency_formats.set(fmts);
9393
}
9494

95-
fn calculate_type<'tcx>(tcx: TyCtxt<'tcx>, ty: config::CrateType) -> DependencyList {
95+
fn calculate_type(tcx: TyCtxt<'_>, ty: config::CrateType) -> DependencyList {
9696
let sess = &tcx.sess;
9797

9898
if !sess.opts.output_types.should_codegen() {
@@ -267,7 +267,7 @@ fn add_library(
267267
}
268268
}
269269

270-
fn attempt_static<'tcx>(tcx: TyCtxt<'tcx>) -> Option<DependencyList> {
270+
fn attempt_static(tcx: TyCtxt<'_>) -> Option<DependencyList> {
271271
let sess = &tcx.sess;
272272
let crates = cstore::used_crates(tcx, RequireStatic);
273273
if !crates.iter().by_ref().all(|&(_, ref p)| p.is_some()) {
@@ -324,7 +324,7 @@ fn activate_injected_dep(injected: Option<CrateNum>,
324324

325325
// After the linkage for a crate has been determined we need to verify that
326326
// there's only going to be one allocator in the output.
327-
fn verify_ok<'tcx>(tcx: TyCtxt<'tcx>, list: &[Linkage]) {
327+
fn verify_ok(tcx: TyCtxt<'_>, list: &[Linkage]) {
328328
let sess = &tcx.sess;
329329
if list.len() == 0 {
330330
return

src/librustc/middle/intrinsicck.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use syntax_pos::{Span, sym};
1010
use crate::hir::intravisit::{self, Visitor, NestedVisitorMap};
1111
use crate::hir;
1212

13-
fn check_mod_intrinsics<'tcx>(tcx: TyCtxt<'tcx>, module_def_id: DefId) {
13+
fn check_mod_intrinsics(tcx: TyCtxt<'_>, module_def_id: DefId) {
1414
tcx.hir().visit_item_likes_in_module(
1515
module_def_id,
1616
&mut ItemVisitor { tcx }.as_deep_visitor()

src/librustc/middle/lib_features.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ impl Visitor<'tcx> for LibFeatureCollector<'tcx> {
142142
}
143143
}
144144

145-
pub fn collect<'tcx>(tcx: TyCtxt<'tcx>) -> LibFeatures {
145+
pub fn collect(tcx: TyCtxt<'_>) -> LibFeatures {
146146
let mut collector = LibFeatureCollector::new(tcx);
147147
intravisit::walk_crate(&mut collector, tcx.hir().krate());
148148
collector.lib_features

src/librustc/middle/liveness.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ impl<'tcx> Visitor<'tcx> for IrMaps<'tcx> {
181181
fn visit_arm(&mut self, a: &'tcx hir::Arm) { visit_arm(self, a); }
182182
}
183183

184-
fn check_mod_liveness<'tcx>(tcx: TyCtxt<'tcx>, module_def_id: DefId) {
184+
fn check_mod_liveness(tcx: TyCtxt<'_>, module_def_id: DefId) {
185185
tcx.hir().visit_item_likes_in_module(
186186
module_def_id,
187187
&mut IrMaps::new(tcx, module_def_id).as_deep_visitor(),

src/librustc/middle/reachable.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ fn item_might_be_inlined(tcx: TyCtxt<'tcx>, item: &hir::Item, attrs: CodegenFnAt
4242
}
4343
}
4444

45-
fn method_might_be_inlined<'tcx>(
46-
tcx: TyCtxt<'tcx>,
45+
fn method_might_be_inlined(
46+
tcx: TyCtxt<'_>,
4747
impl_item: &hir::ImplItem,
4848
impl_src: DefId,
4949
) -> bool {
@@ -391,7 +391,7 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for CollectPrivateImplItemsVisitor<'a, 'tcx
391391
#[derive(Clone, HashStable)]
392392
pub struct ReachableSet(pub Lrc<HirIdSet>);
393393

394-
fn reachable_set<'tcx>(tcx: TyCtxt<'tcx>, crate_num: CrateNum) -> ReachableSet {
394+
fn reachable_set(tcx: TyCtxt<'_>, crate_num: CrateNum) -> ReachableSet {
395395
debug_assert!(crate_num == LOCAL_CRATE);
396396

397397
let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE);

src/librustc/middle/region.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1446,7 +1446,7 @@ impl<'tcx> Visitor<'tcx> for RegionResolutionVisitor<'tcx> {
14461446
}
14471447
}
14481448

1449-
fn region_scope_tree<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx ScopeTree {
1449+
fn region_scope_tree(tcx: TyCtxt<'_>, def_id: DefId) -> &ScopeTree {
14501450
let closure_base_def_id = tcx.closure_base_def_id(def_id);
14511451
if closure_base_def_id != def_id {
14521452
return tcx.region_scope_tree(closure_base_def_id);

src/librustc/middle/resolve_lifetime.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) {
368368
/// entire crate. You should not read the result of this query
369369
/// directly, but rather use `named_region_map`, `is_late_bound_map`,
370370
/// etc.
371-
fn resolve_lifetimes<'tcx>(tcx: TyCtxt<'tcx>, for_krate: CrateNum) -> &'tcx ResolveLifetimes {
371+
fn resolve_lifetimes(tcx: TyCtxt<'_>, for_krate: CrateNum) -> &ResolveLifetimes {
372372
assert_eq!(for_krate, LOCAL_CRATE);
373373

374374
let named_region_map = krate(tcx);
@@ -395,7 +395,7 @@ fn resolve_lifetimes<'tcx>(tcx: TyCtxt<'tcx>, for_krate: CrateNum) -> &'tcx Reso
395395
tcx.arena.alloc(rl)
396396
}
397397

398-
fn krate<'tcx>(tcx: TyCtxt<'tcx>) -> NamedRegionMap {
398+
fn krate(tcx: TyCtxt<'_>) -> NamedRegionMap {
399399
let krate = tcx.hir().krate();
400400
let mut map = NamedRegionMap {
401401
defs: Default::default(),

src/librustc/middle/stability.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ impl<'tcx> Index<'tcx> {
466466

467467
/// Cross-references the feature names of unstable APIs with enabled
468468
/// features and possibly prints errors.
469-
fn check_mod_unstable_api_usage<'tcx>(tcx: TyCtxt<'tcx>, module_def_id: DefId) {
469+
fn check_mod_unstable_api_usage(tcx: TyCtxt<'_>, module_def_id: DefId) {
470470
tcx.hir().visit_item_likes_in_module(module_def_id, &mut Checker { tcx }.as_deep_visitor());
471471
}
472472

@@ -836,7 +836,7 @@ impl<'tcx> TyCtxt<'tcx> {
836836
/// Given the list of enabled features that were not language features (i.e., that
837837
/// were expected to be library features), and the list of features used from
838838
/// libraries, identify activated features that don't exist and error about them.
839-
pub fn check_unused_or_stable_features<'tcx>(tcx: TyCtxt<'tcx>) {
839+
pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
840840
let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE);
841841

842842
if tcx.stability().staged_api[&LOCAL_CRATE] {
@@ -920,8 +920,8 @@ pub fn check_unused_or_stable_features<'tcx>(tcx: TyCtxt<'tcx>) {
920920
// don't lint about unused features. We should reenable this one day!
921921
}
922922

923-
fn unnecessary_stable_feature_lint<'tcx>(
924-
tcx: TyCtxt<'tcx>,
923+
fn unnecessary_stable_feature_lint(
924+
tcx: TyCtxt<'_>,
925925
span: Span,
926926
feature: Symbol,
927927
since: Symbol,

src/librustc/mir/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -2867,19 +2867,19 @@ impl<'tcx> graph::WithStartNode for Body<'tcx> {
28672867
}
28682868

28692869
impl<'tcx> graph::WithPredecessors for Body<'tcx> {
2870-
fn predecessors<'graph>(
2871-
&'graph self,
2870+
fn predecessors(
2871+
&self,
28722872
node: Self::Node,
2873-
) -> <Self as GraphPredecessors<'graph>>::Iter {
2873+
) -> <Self as GraphPredecessors<'_>>::Iter {
28742874
self.predecessors_for(node).clone().into_iter()
28752875
}
28762876
}
28772877

28782878
impl<'tcx> graph::WithSuccessors for Body<'tcx> {
2879-
fn successors<'graph>(
2880-
&'graph self,
2879+
fn successors(
2880+
&self,
28812881
node: Self::Node,
2882-
) -> <Self as GraphSuccessors<'graph>>::Iter {
2882+
) -> <Self as GraphSuccessors<'_>>::Iter {
28832883
self.basic_blocks[node].terminator().successors().cloned()
28842884
}
28852885
}

src/librustc/session/config.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -269,11 +269,11 @@ impl OutputTypes {
269269
self.0.contains_key(key)
270270
}
271271

272-
pub fn keys<'a>(&'a self) -> BTreeMapKeysIter<'a, OutputType, Option<PathBuf>> {
272+
pub fn keys(&self) -> BTreeMapKeysIter<'_, OutputType, Option<PathBuf>> {
273273
self.0.keys()
274274
}
275275

276-
pub fn values<'a>(&'a self) -> BTreeMapValuesIter<'a, OutputType, Option<PathBuf>> {
276+
pub fn values(&self) -> BTreeMapValuesIter<'_, OutputType, Option<PathBuf>> {
277277
self.0.values()
278278
}
279279

@@ -316,7 +316,7 @@ impl Externs {
316316
self.0.get(key)
317317
}
318318

319-
pub fn iter<'a>(&'a self) -> BTreeMapIter<'a, String, ExternEntry> {
319+
pub fn iter(&self) -> BTreeMapIter<'_, String, ExternEntry> {
320320
self.0.iter()
321321
}
322322
}

0 commit comments

Comments
 (0)