Skip to content

Commit 96bcadc

Browse files
committed
auto merge of #14192 : pongad/rust/walkcleanup, r=pcwalton
Fixes #14134
2 parents d78718a + fdb30cd commit 96bcadc

File tree

11 files changed

+30
-37
lines changed

11 files changed

+30
-37
lines changed

src/librustc/middle/borrowck/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ fn borrowck_fn(this: &mut BorrowckCtxt,
144144
check_loans::check_loans(this, &loan_dfcx, flowed_moves,
145145
all_loans.as_slice(), body);
146146

147-
visit::walk_fn(this, fk, decl, body, sp, id, ());
147+
visit::walk_fn(this, fk, decl, body, sp, ());
148148
}
149149

150150
// ----------------------------------------------------------------------
@@ -830,4 +830,3 @@ impl Repr for LoanPath {
830830
}
831831
}
832832
}
833-

src/librustc/middle/check_match.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ impl<'a> Visitor<()> for MatchCheckCtxt<'a> {
3737
fn visit_local(&mut self, l: &Local, _: ()) {
3838
check_local(self, l);
3939
}
40-
fn visit_fn(&mut self, fk: &FnKind, fd: &FnDecl, b: &Block, s: Span, n: NodeId, _: ()) {
41-
check_fn(self, fk, fd, b, s, n);
40+
fn visit_fn(&mut self, fk: &FnKind, fd: &FnDecl, b: &Block, s: Span, _: NodeId, _: ()) {
41+
check_fn(self, fk, fd, b, s);
4242
}
4343
}
4444

@@ -866,9 +866,8 @@ fn check_fn(cx: &mut MatchCheckCtxt,
866866
kind: &FnKind,
867867
decl: &FnDecl,
868868
body: &Block,
869-
sp: Span,
870-
id: NodeId) {
871-
visit::walk_fn(cx, kind, decl, body, sp, id, ());
869+
sp: Span) {
870+
visit::walk_fn(cx, kind, decl, body, sp, ());
872871
for input in decl.inputs.iter() {
873872
if is_refutable(cx, input.pat) {
874873
cx.tcx.sess.span_err(input.pat.span,

src/librustc/middle/effect.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl<'a> EffectCheckVisitor<'a> {
8686

8787
impl<'a> Visitor<()> for EffectCheckVisitor<'a> {
8888
fn visit_fn(&mut self, fn_kind: &visit::FnKind, fn_decl: &ast::FnDecl,
89-
block: &ast::Block, span: Span, node_id: ast::NodeId, _:()) {
89+
block: &ast::Block, span: Span, _: ast::NodeId, _:()) {
9090

9191
let (is_item_fn, is_unsafe_fn) = match *fn_kind {
9292
visit::FkItemFn(_, _, fn_style, _) =>
@@ -103,7 +103,7 @@ impl<'a> Visitor<()> for EffectCheckVisitor<'a> {
103103
self.unsafe_context = SafeContext
104104
}
105105

106-
visit::walk_fn(self, fn_kind, fn_decl, block, span, node_id, ());
106+
visit::walk_fn(self, fn_kind, fn_decl, block, span, ());
107107

108108
self.unsafe_context = old_unsafe_context
109109
}

src/librustc/middle/freevars.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ impl<'a> Visitor<()> for AnnotateFreevarsVisitor<'a> {
115115
blk: &ast::Block, s: Span, nid: ast::NodeId, _: ()) {
116116
let vars = collect_freevars(self.def_map, blk);
117117
self.freevars.insert(nid, vars);
118-
visit::walk_fn(self, fk, fd, blk, s, nid, ());
118+
visit::walk_fn(self, fk, fd, blk, s, ());
119119
}
120120
}
121121

src/librustc/middle/kind.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ fn check_fn(
235235
});
236236
});
237237

238-
visit::walk_fn(cx, fk, decl, body, sp, fn_id, ());
238+
visit::walk_fn(cx, fk, decl, body, sp, ());
239239
}
240240

241241
pub fn check_expr(cx: &mut Context, e: &Expr) {

src/librustc/middle/lint.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,7 +1775,7 @@ impl<'a> Visitor<()> for Context<'a> {
17751775
fn visit_fn(&mut self, fk: &visit::FnKind, decl: &ast::FnDecl,
17761776
body: &ast::Block, span: Span, id: ast::NodeId, _: ()) {
17771777
let recurse = |this: &mut Context| {
1778-
visit::walk_fn(this, fk, decl, body, span, id, ());
1778+
visit::walk_fn(this, fk, decl, body, span, ());
17791779
};
17801780

17811781
for a in decl.inputs.iter(){
@@ -1810,15 +1810,15 @@ impl<'a> Visitor<()> for Context<'a> {
18101810

18111811
fn visit_struct_def(&mut self,
18121812
s: &ast::StructDef,
1813-
i: ast::Ident,
1814-
g: &ast::Generics,
1813+
_: ast::Ident,
1814+
_: &ast::Generics,
18151815
id: ast::NodeId,
18161816
_: ()) {
18171817
check_struct_uppercase_variable(self, s);
18181818

18191819
let old_id = self.cur_struct_def_id;
18201820
self.cur_struct_def_id = id;
1821-
visit::walk_struct_def(self, s, i, g, id, ());
1821+
visit::walk_struct_def(self, s, ());
18221822
self.cur_struct_def_id = old_id;
18231823
}
18241824

src/librustc/middle/liveness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ fn visit_fn(ir: &mut IrMaps,
383383

384384
// gather up the various local variables, significant expressions,
385385
// and so forth:
386-
visit::walk_fn(&mut fn_maps, fk, decl, body, sp, id, ());
386+
visit::walk_fn(&mut fn_maps, fk, decl, body, sp, ());
387387

388388
// Special nodes and variables:
389389
// - exit_ln represents the end of the fn, either by return or fail

src/librustc/middle/privacy.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@ impl Visitor<()> for ParentVisitor {
107107
if !self.parents.contains_key(&id) {
108108
self.parents.insert(id, self.curparent);
109109
}
110-
visit::walk_fn(self, a, b, c, d, id, ());
110+
visit::walk_fn(self, a, b, c, d, ());
111111
}
112112

113-
fn visit_struct_def(&mut self, s: &ast::StructDef, i: ast::Ident,
114-
g: &ast::Generics, n: ast::NodeId, _: ()) {
113+
fn visit_struct_def(&mut self, s: &ast::StructDef, _: ast::Ident,
114+
_: &ast::Generics, n: ast::NodeId, _: ()) {
115115
// Struct constructors are parented to their struct definitions because
116116
// they essentially are the struct definitions.
117117
match s.ctor_id {
@@ -124,7 +124,7 @@ impl Visitor<()> for ParentVisitor {
124124
for field in s.fields.iter() {
125125
self.parents.insert(field.node.id, self.curparent);
126126
}
127-
visit::walk_struct_def(self, s, i, g, n, ())
127+
visit::walk_struct_def(self, s, ())
128128
}
129129
}
130130

@@ -1006,10 +1006,10 @@ impl<'a> Visitor<()> for SanePrivacyVisitor<'a> {
10061006
}
10071007

10081008
fn visit_fn(&mut self, fk: &visit::FnKind, fd: &ast::FnDecl,
1009-
b: &ast::Block, s: Span, n: ast::NodeId, _: ()) {
1009+
b: &ast::Block, s: Span, _: ast::NodeId, _: ()) {
10101010
// This catches both functions and methods
10111011
let orig_in_fn = replace(&mut self.in_fn, true);
1012-
visit::walk_fn(self, fk, fd, b, s, n, ());
1012+
visit::walk_fn(self, fk, fd, b, s, ());
10131013
self.in_fn = orig_in_fn;
10141014
}
10151015

@@ -1363,7 +1363,7 @@ impl<'a> Visitor<()> for VisiblePrivateTypesVisitor<'a> {
13631363
_: ()) {
13641364
// needs special handling for methods.
13651365
if self.exported_items.contains(&id) {
1366-
visit::walk_fn(self, fk, fd, b, s, id, ());
1366+
visit::walk_fn(self, fk, fd, b, s, ());
13671367
}
13681368
}
13691369

src/librustc/middle/resolve_lifetime.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ impl<'a, 'b> Visitor<Scope<'a>> for LifetimeContext<'b> {
102102
visit::FkMethod(_, generics, _) => {
103103
self.visit_fn_decl(
104104
n, generics, scope,
105-
|this, scope1| visit::walk_fn(this, fk, fd, b, s, n, scope1))
105+
|this, scope1| visit::walk_fn(this, fk, fd, b, s, scope1))
106106
}
107107
visit::FkFnBlock(..) => {
108-
visit::walk_fn(self, fk, fd, b, s, n, scope)
108+
visit::walk_fn(self, fk, fd, b, s, scope)
109109
}
110110
}
111111
}

src/libsyntax/ast_util.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,6 @@ impl<'a, O: IdVisitingOperation> Visitor<()> for IdVisitor<'a, O> {
546546
function_declaration,
547547
block,
548548
span,
549-
node_id,
550549
env);
551550

552551
if !self.pass_through_items {
@@ -564,13 +563,13 @@ impl<'a, O: IdVisitingOperation> Visitor<()> for IdVisitor<'a, O> {
564563

565564
fn visit_struct_def(&mut self,
566565
struct_def: &StructDef,
567-
ident: ast::Ident,
568-
generics: &ast::Generics,
566+
_: ast::Ident,
567+
_: &ast::Generics,
569568
id: NodeId,
570569
_: ()) {
571570
self.operation.visit_id(id);
572571
struct_def.ctor_id.map(|ctor_id| self.operation.visit_id(ctor_id));
573-
visit::walk_struct_def(self, struct_def, ident, generics, id, ());
572+
visit::walk_struct_def(self, struct_def, ());
574573
}
575574

576575
fn visit_trait_method(&mut self, tm: &ast::TraitMethod, _: ()) {

src/libsyntax/visit.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ pub trait Visitor<E: Clone> {
7979
fn visit_expr_post(&mut self, _ex: &Expr, _e: E) { }
8080
fn visit_ty(&mut self, t: &Ty, e: E) { walk_ty(self, t, e) }
8181
fn visit_generics(&mut self, g: &Generics, e: E) { walk_generics(self, g, e) }
82-
fn visit_fn(&mut self, fk: &FnKind, fd: &FnDecl, b: &Block, s: Span, n: NodeId, e: E) {
83-
walk_fn(self, fk, fd, b, s, n , e)
82+
fn visit_fn(&mut self, fk: &FnKind, fd: &FnDecl, b: &Block, s: Span, _: NodeId, e: E) {
83+
walk_fn(self, fk, fd, b, s, e)
8484
}
8585
fn visit_ty_method(&mut self, t: &TypeMethod, e: E) { walk_ty_method(self, t, e) }
8686
fn visit_trait_method(&mut self, t: &TraitMethod, e: E) { walk_trait_method(self, t, e) }
87-
fn visit_struct_def(&mut self, s: &StructDef, i: Ident, g: &Generics, n: NodeId, e: E) {
88-
walk_struct_def(self, s, i, g, n, e)
87+
fn visit_struct_def(&mut self, s: &StructDef, _: Ident, _: &Generics, _: NodeId, e: E) {
88+
walk_struct_def(self, s, e)
8989
}
9090
fn visit_struct_field(&mut self, s: &StructField, e: E) { walk_struct_field(self, s, e) }
9191
fn visit_variant(&mut self, v: &Variant, g: &Generics, e: E) { walk_variant(self, v, g, e) }
@@ -522,7 +522,6 @@ pub fn walk_fn<E: Clone, V: Visitor<E>>(visitor: &mut V,
522522
function_declaration: &FnDecl,
523523
function_body: &Block,
524524
_span: Span,
525-
_: NodeId,
526525
env: E) {
527526
walk_fn_decl(visitor, function_declaration, env.clone());
528527

@@ -566,9 +565,6 @@ pub fn walk_trait_method<E: Clone, V: Visitor<E>>(visitor: &mut V,
566565

567566
pub fn walk_struct_def<E: Clone, V: Visitor<E>>(visitor: &mut V,
568567
struct_definition: &StructDef,
569-
_: Ident,
570-
_: &Generics,
571-
_: NodeId,
572568
env: E) {
573569
match struct_definition.super_struct {
574570
Some(t) => visitor.visit_ty(t, env.clone()),

0 commit comments

Comments
 (0)