Skip to content

Commit 0644aba

Browse files
committed
Remove the type parameter from syntax::visit::Visitor
1 parent 683e480 commit 0644aba

File tree

19 files changed

+169
-188
lines changed

19 files changed

+169
-188
lines changed

src/librustc/hir/check_attr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl<'a> CheckAttrVisitor<'a> {
9595
}
9696
}
9797

98-
impl<'a, 'v> Visitor<'v> for CheckAttrVisitor<'a> {
98+
impl<'a> Visitor for CheckAttrVisitor<'a> {
9999
fn visit_item(&mut self, item: &ast::Item) {
100100
let target = Target::from_item(item);
101101
for attr in &item.attrs {

src/librustc/hir/lowering.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ impl<'a> LoweringContext<'a> {
138138
lctx: &'lcx mut LoweringContext<'interner>,
139139
}
140140

141-
impl<'lcx, 'interner> Visitor<'lcx> for ItemLowerer<'lcx, 'interner> {
142-
fn visit_item(&mut self, item: &'lcx Item) {
141+
impl<'lcx, 'interner> Visitor for ItemLowerer<'lcx, 'interner> {
142+
fn visit_item(&mut self, item: &Item) {
143143
self.items.insert(item.id, self.lctx.lower_item(item));
144144
visit::walk_item(self, item);
145145
}

src/librustc/hir/map/def_collector.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl<'ast> DefCollector<'ast> {
9898
self.parent_def = parent;
9999
}
100100

101-
fn visit_ast_const_integer(&mut self, expr: &'ast Expr) {
101+
fn visit_ast_const_integer(&mut self, expr: &Expr) {
102102
// Find the node which will be used after lowering.
103103
if let ExprKind::Paren(ref inner) = expr.node {
104104
return self.visit_ast_const_integer(inner);
@@ -124,8 +124,8 @@ impl<'ast> DefCollector<'ast> {
124124
}
125125
}
126126

127-
impl<'ast> visit::Visitor<'ast> for DefCollector<'ast> {
128-
fn visit_item(&mut self, i: &'ast Item) {
127+
impl<'ast> visit::Visitor for DefCollector<'ast> {
128+
fn visit_item(&mut self, i: &Item) {
129129
debug!("visit_item: {:?}", i);
130130

131131
// Pick the def data. This need not be unique, but the more
@@ -183,23 +183,23 @@ impl<'ast> visit::Visitor<'ast> for DefCollector<'ast> {
183183
});
184184
}
185185

186-
fn visit_foreign_item(&mut self, foreign_item: &'ast ForeignItem) {
186+
fn visit_foreign_item(&mut self, foreign_item: &ForeignItem) {
187187
let def = self.create_def(foreign_item.id, DefPathData::ValueNs(foreign_item.ident.name));
188188

189189
self.with_parent(def, |this| {
190190
visit::walk_foreign_item(this, foreign_item);
191191
});
192192
}
193193

194-
fn visit_generics(&mut self, generics: &'ast Generics) {
194+
fn visit_generics(&mut self, generics: &Generics) {
195195
for ty_param in generics.ty_params.iter() {
196196
self.create_def(ty_param.id, DefPathData::TypeParam(ty_param.ident.name));
197197
}
198198

199199
visit::walk_generics(self, generics);
200200
}
201201

202-
fn visit_trait_item(&mut self, ti: &'ast TraitItem) {
202+
fn visit_trait_item(&mut self, ti: &TraitItem) {
203203
let def_data = match ti.node {
204204
TraitItemKind::Method(..) | TraitItemKind::Const(..) =>
205205
DefPathData::ValueNs(ti.ident.name),
@@ -216,7 +216,7 @@ impl<'ast> visit::Visitor<'ast> for DefCollector<'ast> {
216216
});
217217
}
218218

219-
fn visit_impl_item(&mut self, ii: &'ast ImplItem) {
219+
fn visit_impl_item(&mut self, ii: &ImplItem) {
220220
let def_data = match ii.node {
221221
ImplItemKind::Method(..) | ImplItemKind::Const(..) =>
222222
DefPathData::ValueNs(ii.ident.name),
@@ -234,7 +234,7 @@ impl<'ast> visit::Visitor<'ast> for DefCollector<'ast> {
234234
});
235235
}
236236

237-
fn visit_pat(&mut self, pat: &'ast Pat) {
237+
fn visit_pat(&mut self, pat: &Pat) {
238238
let parent_def = self.parent_def;
239239

240240
if let PatKind::Ident(_, id, _) = pat.node {
@@ -246,7 +246,7 @@ impl<'ast> visit::Visitor<'ast> for DefCollector<'ast> {
246246
self.parent_def = parent_def;
247247
}
248248

249-
fn visit_expr(&mut self, expr: &'ast Expr) {
249+
fn visit_expr(&mut self, expr: &Expr) {
250250
let parent_def = self.parent_def;
251251

252252
if let ExprKind::Repeat(_, ref count) = expr.node {
@@ -262,18 +262,18 @@ impl<'ast> visit::Visitor<'ast> for DefCollector<'ast> {
262262
self.parent_def = parent_def;
263263
}
264264

265-
fn visit_ty(&mut self, ty: &'ast Ty) {
265+
fn visit_ty(&mut self, ty: &Ty) {
266266
if let TyKind::FixedLengthVec(_, ref length) = ty.node {
267267
self.visit_ast_const_integer(length);
268268
}
269269
visit::walk_ty(self, ty);
270270
}
271271

272-
fn visit_lifetime_def(&mut self, def: &'ast LifetimeDef) {
272+
fn visit_lifetime_def(&mut self, def: &LifetimeDef) {
273273
self.create_def(def.lifetime.id, DefPathData::LifetimeDef(def.lifetime.name));
274274
}
275275

276-
fn visit_macro_def(&mut self, macro_def: &'ast MacroDef) {
276+
fn visit_macro_def(&mut self, macro_def: &MacroDef) {
277277
self.create_def(macro_def.id, DefPathData::MacroDef(macro_def.ident.name));
278278
}
279279
}

src/librustc/lint/context.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ impl<'a, 'tcx, 'v> hir_visit::Visitor<'v> for LateContext<'a, 'tcx> {
905905
}
906906
}
907907

908-
impl<'a, 'v> ast_visit::Visitor<'v> for EarlyContext<'a> {
908+
impl<'a> ast_visit::Visitor for EarlyContext<'a> {
909909
fn visit_item(&mut self, it: &ast::Item) {
910910
self.with_lint_attrs(&it.attrs, |cx| {
911911
run_lints!(cx, check_item, early_passes, it);
@@ -939,8 +939,8 @@ impl<'a, 'v> ast_visit::Visitor<'v> for EarlyContext<'a> {
939939
ast_visit::walk_stmt(self, s);
940940
}
941941

942-
fn visit_fn(&mut self, fk: ast_visit::FnKind<'v>, decl: &'v ast::FnDecl,
943-
body: &'v ast::Block, span: Span, id: ast::NodeId) {
942+
fn visit_fn(&mut self, fk: ast_visit::FnKind, decl: &ast::FnDecl,
943+
body: &ast::Block, span: Span, id: ast::NodeId) {
944944
run_lints!(self, check_fn, early_passes, fk, decl, body, span, id);
945945
ast_visit::walk_fn(self, fk, decl, body, span);
946946
run_lints!(self, check_fn_post, early_passes, fk, decl, body, span, id);

src/librustc_metadata/creader.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ pub struct CrateReader<'a> {
5858
local_crate_name: String,
5959
}
6060

61-
impl<'a, 'ast> visit::Visitor<'ast> for LocalCrateReader<'a> {
62-
fn visit_item(&mut self, a: &'ast ast::Item) {
61+
impl<'a> visit::Visitor for LocalCrateReader<'a> {
62+
fn visit_item(&mut self, a: &ast::Item) {
6363
self.process_item(a);
6464
visit::walk_item(self, a);
6565
}

src/librustc_passes/ast_validation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl<'a> AstValidator<'a> {
5757
}
5858
}
5959

60-
impl<'a, 'v> Visitor<'v> for AstValidator<'a> {
60+
impl<'a> Visitor for AstValidator<'a> {
6161
fn visit_lifetime(&mut self, lt: &Lifetime) {
6262
if lt.name.as_str() == "'_" {
6363
self.session.add_lint(

src/librustc_passes/no_asm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ struct CheckNoAsm<'a> {
2929
sess: &'a Session,
3030
}
3131

32-
impl<'a, 'v> Visitor<'v> for CheckNoAsm<'a> {
32+
impl<'a> Visitor for CheckNoAsm<'a> {
3333
fn visit_expr(&mut self, e: &ast::Expr) {
3434
match e.node {
3535
ast::ExprKind::InlineAsm(_) => span_err!(self.sess, e.span, E0472,

src/librustc_resolve/build_reduced_graph.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ struct BuildReducedGraphVisitor<'a, 'b: 'a> {
503503
parent: Module<'b>,
504504
}
505505

506-
impl<'a, 'b, 'v> Visitor<'v> for BuildReducedGraphVisitor<'a, 'b> {
506+
impl<'a, 'b> Visitor for BuildReducedGraphVisitor<'a, 'b> {
507507
fn visit_item(&mut self, item: &Item) {
508508
let old_parent = self.parent;
509509
self.resolver.build_reduced_graph_for_item(item, &mut self.parent);

src/librustc_resolve/check_unused.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl<'a, 'b> UnusedImportCheckVisitor<'a, 'b> {
7171
}
7272
}
7373

74-
impl<'a, 'b, 'v> Visitor<'v> for UnusedImportCheckVisitor<'a, 'b> {
74+
impl<'a, 'b> Visitor for UnusedImportCheckVisitor<'a, 'b> {
7575
fn visit_item(&mut self, item: &ast::Item) {
7676
visit::walk_item(self, item);
7777
// Ignore is_public import statements because there's no way to be sure

src/librustc_resolve/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ pub enum Namespace {
500500
ValueNS,
501501
}
502502

503-
impl<'a, 'v> Visitor<'v> for Resolver<'a> {
503+
impl<'a> Visitor for Resolver<'a> {
504504
fn visit_item(&mut self, item: &Item) {
505505
self.resolve_item(item);
506506
}
@@ -562,9 +562,9 @@ impl<'a, 'v> Visitor<'v> for Resolver<'a> {
562562
});
563563
}
564564
fn visit_fn(&mut self,
565-
function_kind: FnKind<'v>,
566-
declaration: &'v FnDecl,
567-
block: &'v Block,
565+
function_kind: FnKind,
566+
declaration: &FnDecl,
567+
block: &Block,
568568
_: Span,
569569
node_id: NodeId) {
570570
let rib_kind = match function_kind {

src/librustc_save_analysis/dump_visitor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
10131013
}
10141014
}
10151015

1016-
impl<'v, 'l, 'tcx: 'l, 'll, D: Dump +'ll> Visitor<'v> for DumpVisitor<'l, 'tcx, 'll, D> {
1016+
impl<'l, 'tcx: 'l, 'll, D: Dump +'ll> Visitor for DumpVisitor<'l, 'tcx, 'll, D> {
10171017
fn visit_item(&mut self, item: &ast::Item) {
10181018
use syntax::ast::ItemKind::*;
10191019
self.process_macro_use(item.span, item.id);

src/librustc_save_analysis/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ impl PathCollector {
686686
}
687687
}
688688

689-
impl<'v> Visitor<'v> for PathCollector {
689+
impl Visitor for PathCollector {
690690
fn visit_pat(&mut self, p: &ast::Pat) {
691691
match p.node {
692692
PatKind::Struct(ref path, _, _) => {

src/libsyntax/ext/expand.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ struct PatIdentFinder {
573573
ident_accumulator: Vec<ast::Ident>
574574
}
575575

576-
impl<'v> Visitor<'v> for PatIdentFinder {
576+
impl Visitor for PatIdentFinder {
577577
fn visit_pat(&mut self, pattern: &ast::Pat) {
578578
match *pattern {
579579
ast::Pat { id: _, node: PatKind::Ident(_, ref path1, ref inner), span: _ } => {
@@ -1226,7 +1226,7 @@ mod tests {
12261226
path_accumulator: Vec<ast::Path> ,
12271227
}
12281228

1229-
impl<'v> Visitor<'v> for PathExprFinderContext {
1229+
impl Visitor for PathExprFinderContext {
12301230
fn visit_expr(&mut self, expr: &ast::Expr) {
12311231
if let ast::ExprKind::Path(None, ref p) = expr.node {
12321232
self.path_accumulator.push(p.clone());
@@ -1248,7 +1248,7 @@ mod tests {
12481248
ident_accumulator: Vec<ast::Ident>
12491249
}
12501250

1251-
impl<'v> Visitor<'v> for IdentFinder {
1251+
impl Visitor for IdentFinder {
12521252
fn visit_ident(&mut self, _: codemap::Span, id: ast::Ident){
12531253
self.ident_accumulator.push(id);
12541254
}

src/libsyntax/feature_gate.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ macro_rules! gate_feature_post {
849849
}}
850850
}
851851

852-
impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
852+
impl<'a> Visitor for PostExpansionVisitor<'a> {
853853
fn visit_attribute(&mut self, attr: &ast::Attribute) {
854854
if !self.context.cm.span_allows_unstable(attr.span) {
855855
self.context.check_attribute(attr, false);
@@ -1045,9 +1045,9 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
10451045
}
10461046

10471047
fn visit_fn(&mut self,
1048-
fn_kind: FnKind<'v>,
1049-
fn_decl: &'v ast::FnDecl,
1050-
block: &'v ast::Block,
1048+
fn_kind: FnKind,
1049+
fn_decl: &ast::FnDecl,
1050+
block: &ast::Block,
10511051
span: Span,
10521052
_node_id: NodeId) {
10531053
// check for const fn declarations
@@ -1086,7 +1086,7 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
10861086
visit::walk_fn(self, fn_kind, fn_decl, block, span);
10871087
}
10881088

1089-
fn visit_trait_item(&mut self, ti: &'v ast::TraitItem) {
1089+
fn visit_trait_item(&mut self, ti: &ast::TraitItem) {
10901090
match ti.node {
10911091
ast::TraitItemKind::Const(..) => {
10921092
gate_feature_post!(&self, associated_consts,
@@ -1107,7 +1107,7 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
11071107
visit::walk_trait_item(self, ti);
11081108
}
11091109

1110-
fn visit_impl_item(&mut self, ii: &'v ast::ImplItem) {
1110+
fn visit_impl_item(&mut self, ii: &ast::ImplItem) {
11111111
if ii.defaultness == ast::Defaultness::Default {
11121112
gate_feature_post!(&self, specialization,
11131113
ii.span,
@@ -1130,7 +1130,7 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
11301130
visit::walk_impl_item(self, ii);
11311131
}
11321132

1133-
fn visit_vis(&mut self, vis: &'v ast::Visibility) {
1133+
fn visit_vis(&mut self, vis: &ast::Visibility) {
11341134
let span = match *vis {
11351135
ast::Visibility::Crate(span) => span,
11361136
ast::Visibility::Restricted { ref path, .. } => path.span,

src/libsyntax/parse/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -991,8 +991,8 @@ mod tests {
991991
struct PatIdentVisitor {
992992
spans: Vec<Span>
993993
}
994-
impl<'v> ::visit::Visitor<'v> for PatIdentVisitor {
995-
fn visit_pat(&mut self, p: &'v ast::Pat) {
994+
impl ::visit::Visitor for PatIdentVisitor {
995+
fn visit_pat(&mut self, p: &ast::Pat) {
996996
match p.node {
997997
PatKind::Ident(_ , ref spannedident, _) => {
998998
self.spans.push(spannedident.span.clone());

src/libsyntax/show_span.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ struct ShowSpanVisitor<'a> {
4444
mode: Mode,
4545
}
4646

47-
impl<'a, 'v> Visitor<'v> for ShowSpanVisitor<'a> {
47+
impl<'a> Visitor for ShowSpanVisitor<'a> {
4848
fn visit_expr(&mut self, e: &ast::Expr) {
4949
if let Mode::Expression = self.mode {
5050
self.span_diagnostic.span_warn(e.span, "expression");

0 commit comments

Comments
 (0)