Skip to content

Removed unnecessary arguments for walk_* functions #14192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/librustc/middle/borrowck/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ fn borrowck_fn(this: &mut BorrowckCtxt,
check_loans::check_loans(this, &loan_dfcx, flowed_moves,
all_loans.as_slice(), body);

visit::walk_fn(this, fk, decl, body, sp, id, ());
visit::walk_fn(this, fk, decl, body, sp, ());
}

// ----------------------------------------------------------------------
Expand Down Expand Up @@ -830,4 +830,3 @@ impl Repr for LoanPath {
}
}
}

9 changes: 4 additions & 5 deletions src/librustc/middle/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ impl<'a> Visitor<()> for MatchCheckCtxt<'a> {
fn visit_local(&mut self, l: &Local, _: ()) {
check_local(self, l);
}
fn visit_fn(&mut self, fk: &FnKind, fd: &FnDecl, b: &Block, s: Span, n: NodeId, _: ()) {
check_fn(self, fk, fd, b, s, n);
fn visit_fn(&mut self, fk: &FnKind, fd: &FnDecl, b: &Block, s: Span, _: NodeId, _: ()) {
check_fn(self, fk, fd, b, s);
}
}

Expand Down Expand Up @@ -866,9 +866,8 @@ fn check_fn(cx: &mut MatchCheckCtxt,
kind: &FnKind,
decl: &FnDecl,
body: &Block,
sp: Span,
id: NodeId) {
visit::walk_fn(cx, kind, decl, body, sp, id, ());
sp: Span) {
visit::walk_fn(cx, kind, decl, body, sp, ());
for input in decl.inputs.iter() {
if is_refutable(cx, input.pat) {
cx.tcx.sess.span_err(input.pat.span,
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/effect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl<'a> EffectCheckVisitor<'a> {

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

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

visit::walk_fn(self, fn_kind, fn_decl, block, span, node_id, ());
visit::walk_fn(self, fn_kind, fn_decl, block, span, ());

self.unsafe_context = old_unsafe_context
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/freevars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ impl<'a> Visitor<()> for AnnotateFreevarsVisitor<'a> {
blk: &ast::Block, s: Span, nid: ast::NodeId, _: ()) {
let vars = collect_freevars(self.def_map, blk);
self.freevars.insert(nid, vars);
visit::walk_fn(self, fk, fd, blk, s, nid, ());
visit::walk_fn(self, fk, fd, blk, s, ());
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ fn check_fn(
});
});

visit::walk_fn(cx, fk, decl, body, sp, fn_id, ());
visit::walk_fn(cx, fk, decl, body, sp, ());
}

pub fn check_expr(cx: &mut Context, e: &Expr) {
Expand Down
8 changes: 4 additions & 4 deletions src/librustc/middle/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1775,7 +1775,7 @@ impl<'a> Visitor<()> for Context<'a> {
fn visit_fn(&mut self, fk: &visit::FnKind, decl: &ast::FnDecl,
body: &ast::Block, span: Span, id: ast::NodeId, _: ()) {
let recurse = |this: &mut Context| {
visit::walk_fn(this, fk, decl, body, span, id, ());
visit::walk_fn(this, fk, decl, body, span, ());
};

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

fn visit_struct_def(&mut self,
s: &ast::StructDef,
i: ast::Ident,
g: &ast::Generics,
_: ast::Ident,
_: &ast::Generics,
id: ast::NodeId,
_: ()) {
check_struct_uppercase_variable(self, s);

let old_id = self.cur_struct_def_id;
self.cur_struct_def_id = id;
visit::walk_struct_def(self, s, i, g, id, ());
visit::walk_struct_def(self, s, ());
self.cur_struct_def_id = old_id;
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/liveness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ fn visit_fn(ir: &mut IrMaps,

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

// Special nodes and variables:
// - exit_ln represents the end of the fn, either by return or fail
Expand Down
14 changes: 7 additions & 7 deletions src/librustc/middle/privacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ impl Visitor<()> for ParentVisitor {
if !self.parents.contains_key(&id) {
self.parents.insert(id, self.curparent);
}
visit::walk_fn(self, a, b, c, d, id, ());
visit::walk_fn(self, a, b, c, d, ());
}

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

Expand Down Expand Up @@ -1006,10 +1006,10 @@ impl<'a> Visitor<()> for SanePrivacyVisitor<'a> {
}

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

Expand Down Expand Up @@ -1363,7 +1363,7 @@ impl<'a> Visitor<()> for VisiblePrivateTypesVisitor<'a> {
_: ()) {
// needs special handling for methods.
if self.exported_items.contains(&id) {
visit::walk_fn(self, fk, fd, b, s, id, ());
visit::walk_fn(self, fk, fd, b, s, ());
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/resolve_lifetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ impl<'a, 'b> Visitor<Scope<'a>> for LifetimeContext<'b> {
visit::FkMethod(_, generics, _) => {
self.visit_fn_decl(
n, generics, scope,
|this, scope1| visit::walk_fn(this, fk, fd, b, s, n, scope1))
|this, scope1| visit::walk_fn(this, fk, fd, b, s, scope1))
}
visit::FkFnBlock(..) => {
visit::walk_fn(self, fk, fd, b, s, n, scope)
visit::walk_fn(self, fk, fd, b, s, scope)
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions src/libsyntax/ast_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,6 @@ impl<'a, O: IdVisitingOperation> Visitor<()> for IdVisitor<'a, O> {
function_declaration,
block,
span,
node_id,
env);

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

fn visit_struct_def(&mut self,
struct_def: &StructDef,
ident: ast::Ident,
generics: &ast::Generics,
_: ast::Ident,
_: &ast::Generics,
id: NodeId,
_: ()) {
self.operation.visit_id(id);
struct_def.ctor_id.map(|ctor_id| self.operation.visit_id(ctor_id));
visit::walk_struct_def(self, struct_def, ident, generics, id, ());
visit::walk_struct_def(self, struct_def, ());
}

fn visit_trait_method(&mut self, tm: &ast::TraitMethod, _: ()) {
Expand Down
12 changes: 4 additions & 8 deletions src/libsyntax/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ pub trait Visitor<E: Clone> {
fn visit_expr_post(&mut self, _ex: &Expr, _e: E) { }
fn visit_ty(&mut self, t: &Ty, e: E) { walk_ty(self, t, e) }
fn visit_generics(&mut self, g: &Generics, e: E) { walk_generics(self, g, e) }
fn visit_fn(&mut self, fk: &FnKind, fd: &FnDecl, b: &Block, s: Span, n: NodeId, e: E) {
walk_fn(self, fk, fd, b, s, n , e)
fn visit_fn(&mut self, fk: &FnKind, fd: &FnDecl, b: &Block, s: Span, _: NodeId, e: E) {
walk_fn(self, fk, fd, b, s, e)
}
fn visit_ty_method(&mut self, t: &TypeMethod, e: E) { walk_ty_method(self, t, e) }
fn visit_trait_method(&mut self, t: &TraitMethod, e: E) { walk_trait_method(self, t, e) }
fn visit_struct_def(&mut self, s: &StructDef, i: Ident, g: &Generics, n: NodeId, e: E) {
walk_struct_def(self, s, i, g, n, e)
fn visit_struct_def(&mut self, s: &StructDef, _: Ident, _: &Generics, _: NodeId, e: E) {
walk_struct_def(self, s, e)
}
fn visit_struct_field(&mut self, s: &StructField, e: E) { walk_struct_field(self, s, e) }
fn visit_variant(&mut self, v: &Variant, g: &Generics, e: E) { walk_variant(self, v, g, e) }
Expand Down Expand Up @@ -522,7 +522,6 @@ pub fn walk_fn<E: Clone, V: Visitor<E>>(visitor: &mut V,
function_declaration: &FnDecl,
function_body: &Block,
_span: Span,
_: NodeId,
env: E) {
walk_fn_decl(visitor, function_declaration, env.clone());

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

pub fn walk_struct_def<E: Clone, V: Visitor<E>>(visitor: &mut V,
struct_definition: &StructDef,
_: Ident,
_: &Generics,
_: NodeId,
env: E) {
match struct_definition.super_struct {
Some(t) => visitor.visit_ty(t, env.clone()),
Expand Down