Remove unused span argument from walk_fn.

This commit is contained in:
Nicholas Nethercote 2022-09-12 13:13:22 +10:00
parent 6568ef338e
commit 925363f13d
13 changed files with 22 additions and 23 deletions

View File

@ -156,8 +156,8 @@ pub trait Visitor<'ast>: Sized {
fn visit_where_predicate(&mut self, p: &'ast WherePredicate) { fn visit_where_predicate(&mut self, p: &'ast WherePredicate) {
walk_where_predicate(self, p) walk_where_predicate(self, p)
} }
fn visit_fn(&mut self, fk: FnKind<'ast>, s: Span, _: NodeId) { fn visit_fn(&mut self, fk: FnKind<'ast>, _: Span, _: NodeId) {
walk_fn(self, fk, s) walk_fn(self, fk)
} }
fn visit_assoc_item(&mut self, i: &'ast AssocItem, ctxt: AssocCtxt) { fn visit_assoc_item(&mut self, i: &'ast AssocItem, ctxt: AssocCtxt) {
walk_assoc_item(self, i, ctxt) walk_assoc_item(self, i, ctxt)
@ -655,7 +655,7 @@ pub fn walk_fn_decl<'a, V: Visitor<'a>>(visitor: &mut V, function_declaration: &
visitor.visit_fn_ret_ty(&function_declaration.output); visitor.visit_fn_ret_ty(&function_declaration.output);
} }
pub fn walk_fn<'a, V: Visitor<'a>>(visitor: &mut V, kind: FnKind<'a>, _span: Span) { pub fn walk_fn<'a, V: Visitor<'a>>(visitor: &mut V, kind: FnKind<'a>) {
match kind { match kind {
FnKind::Fn(_, _, sig, _, generics, body) => { FnKind::Fn(_, _, sig, _, generics, body) => {
visitor.visit_generics(generics); visitor.visit_generics(generics);

View File

@ -279,12 +279,12 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
fk: intravisit::FnKind<'hir>, fk: intravisit::FnKind<'hir>,
fd: &'hir FnDecl<'hir>, fd: &'hir FnDecl<'hir>,
b: BodyId, b: BodyId,
s: Span, _: Span,
id: HirId, id: HirId,
) { ) {
assert_eq!(self.owner, id.owner); assert_eq!(self.owner, id.owner);
assert_eq!(self.parent_node, id.local_id); assert_eq!(self.parent_node, id.local_id);
intravisit::walk_fn(self, fk, fd, b, s, id); intravisit::walk_fn(self, fk, fd, b, id);
} }
fn visit_block(&mut self, block: &'hir Block<'hir>) { fn visit_block(&mut self, block: &'hir Block<'hir>) {

View File

@ -1527,7 +1527,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
matches!(fk.header(), Some(FnHeader { constness: Const::Yes(_), .. })) matches!(fk.header(), Some(FnHeader { constness: Const::Yes(_), .. }))
|| matches!(fk.ctxt(), Some(FnCtxt::Assoc(_))); || matches!(fk.ctxt(), Some(FnCtxt::Assoc(_)));
self.with_tilde_const(tilde_const_allowed, |this| visit::walk_fn(this, fk, span)); self.with_tilde_const(tilde_const_allowed, |this| visit::walk_fn(this, fk));
} }
fn visit_assoc_item(&mut self, item: &'a AssocItem, ctxt: AssocCtxt) { fn visit_assoc_item(&mut self, item: &'a AssocItem, ctxt: AssocCtxt) {

View File

@ -699,7 +699,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
gate_feature_post!(&self, c_variadic, span, "C-variadic functions are unstable"); gate_feature_post!(&self, c_variadic, span, "C-variadic functions are unstable");
} }
visit::walk_fn(self, fn_kind, span) visit::walk_fn(self, fn_kind)
} }
fn visit_assoc_constraint(&mut self, constraint: &'a AssocConstraint) { fn visit_assoc_constraint(&mut self, constraint: &'a AssocConstraint) {

View File

@ -63,9 +63,9 @@ impl<'ast> Visitor<'ast> for NodeCounter {
self.count += 1; self.count += 1;
walk_generics(self, g) walk_generics(self, g)
} }
fn visit_fn(&mut self, fk: visit::FnKind<'_>, s: Span, _: NodeId) { fn visit_fn(&mut self, fk: visit::FnKind<'_>, _: Span, _: NodeId) {
self.count += 1; self.count += 1;
walk_fn(self, fk, s) walk_fn(self, fk)
} }
fn visit_assoc_item(&mut self, ti: &AssocItem, ctxt: AssocCtxt) { fn visit_assoc_item(&mut self, ti: &AssocItem, ctxt: AssocCtxt) {
self.count += 1; self.count += 1;

View File

@ -361,8 +361,8 @@ pub trait Visitor<'v>: Sized {
fn visit_fn_decl(&mut self, fd: &'v FnDecl<'v>) { fn visit_fn_decl(&mut self, fd: &'v FnDecl<'v>) {
walk_fn_decl(self, fd) walk_fn_decl(self, fd)
} }
fn visit_fn(&mut self, fk: FnKind<'v>, fd: &'v FnDecl<'v>, b: BodyId, s: Span, id: HirId) { fn visit_fn(&mut self, fk: FnKind<'v>, fd: &'v FnDecl<'v>, b: BodyId, _: Span, id: HirId) {
walk_fn(self, fk, fd, b, s, id) walk_fn(self, fk, fd, b, id)
} }
fn visit_use(&mut self, path: &'v Path<'v>, hir_id: HirId) { fn visit_use(&mut self, path: &'v Path<'v>, hir_id: HirId) {
walk_use(self, path, hir_id) walk_use(self, path, hir_id)
@ -898,7 +898,6 @@ pub fn walk_fn<'v, V: Visitor<'v>>(
function_kind: FnKind<'v>, function_kind: FnKind<'v>,
function_declaration: &'v FnDecl<'v>, function_declaration: &'v FnDecl<'v>,
body_id: BodyId, body_id: BodyId,
_span: Span,
id: HirId, id: HirId,
) { ) {
visitor.visit_id(id); visitor.visit_id(id);

View File

@ -147,7 +147,7 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>
fn visit_fn(&mut self, fk: ast_visit::FnKind<'a>, span: Span, id: ast::NodeId) { fn visit_fn(&mut self, fk: ast_visit::FnKind<'a>, span: Span, id: ast::NodeId) {
run_early_pass!(self, check_fn, fk, span, id); run_early_pass!(self, check_fn, fk, span, id);
self.check_id(id); self.check_id(id);
ast_visit::walk_fn(self, fk, span); ast_visit::walk_fn(self, fk);
// Explicitly check for lints associated with 'closure_id', since // Explicitly check for lints associated with 'closure_id', since
// it does not have a corresponding AST node // it does not have a corresponding AST node

View File

@ -187,7 +187,7 @@ impl<'tcx, T: LateLintPass<'tcx>> hir_visit::Visitor<'tcx> for LateContextAndPas
let old_cached_typeck_results = self.context.cached_typeck_results.take(); let old_cached_typeck_results = self.context.cached_typeck_results.take();
let body = self.context.tcx.hir().body(body_id); let body = self.context.tcx.hir().body(body_id);
lint_callback!(self, check_fn, fk, decl, body, span, id); lint_callback!(self, check_fn, fk, decl, body, span, id);
hir_visit::walk_fn(self, fk, decl, body_id, span, id); hir_visit::walk_fn(self, fk, decl, body_id, id);
self.context.enclosing_body = old_enclosing_body; self.context.enclosing_body = old_enclosing_body;
self.context.cached_typeck_results.set(old_cached_typeck_results); self.context.cached_typeck_results.set(old_cached_typeck_results);
} }

View File

@ -362,11 +362,11 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
fk: hir_visit::FnKind<'v>, fk: hir_visit::FnKind<'v>,
fd: &'v hir::FnDecl<'v>, fd: &'v hir::FnDecl<'v>,
b: hir::BodyId, b: hir::BodyId,
s: Span, _: Span,
id: hir::HirId, id: hir::HirId,
) { ) {
self.record("FnDecl", Id::None, fd); self.record("FnDecl", Id::None, fd);
hir_visit::walk_fn(self, fk, fd, b, s, id) hir_visit::walk_fn(self, fk, fd, b, id)
} }
fn visit_use(&mut self, p: &'v hir::Path<'v>, hir_id: hir::HirId) { fn visit_use(&mut self, p: &'v hir::Path<'v>, hir_id: hir::HirId) {
@ -612,9 +612,9 @@ impl<'v> ast_visit::Visitor<'v> for StatCollector<'v> {
ast_visit::walk_where_predicate(self, p) ast_visit::walk_where_predicate(self, p)
} }
fn visit_fn(&mut self, fk: ast_visit::FnKind<'v>, s: Span, _: NodeId) { fn visit_fn(&mut self, fk: ast_visit::FnKind<'v>, _: Span, _: NodeId) {
self.record("FnDecl", Id::None, fk.decl()); self.record("FnDecl", Id::None, fk.decl());
ast_visit::walk_fn(self, fk, s) ast_visit::walk_fn(self, fk)
} }
fn visit_assoc_item(&mut self, i: &'v ast::AssocItem, ctxt: ast_visit::AssocCtxt) { fn visit_assoc_item(&mut self, i: &'v ast::AssocItem, ctxt: ast_visit::AssocCtxt) {

View File

@ -154,7 +154,7 @@ impl<'a, 'b> visit::Visitor<'a> for DefCollector<'a, 'b> {
} }
} }
visit::walk_fn(self, fn_kind, span); visit::walk_fn(self, fn_kind);
} }
fn visit_use_tree(&mut self, use_tree: &'a UseTree, id: NodeId, _nested: bool) { fn visit_use_tree(&mut self, use_tree: &'a UseTree, id: NodeId, _nested: bool) {

View File

@ -425,7 +425,7 @@ struct UnsafeVisitor<'a, 'tcx> {
impl<'tcx> Visitor<'tcx> for UnsafeVisitor<'_, 'tcx> { impl<'tcx> Visitor<'tcx> for UnsafeVisitor<'_, 'tcx> {
type NestedFilter = nested_filter::All; type NestedFilter = nested_filter::All;
fn visit_fn(&mut self, kind: FnKind<'tcx>, decl: &'tcx FnDecl<'_>, body_id: BodyId, span: Span, id: HirId) { fn visit_fn(&mut self, kind: FnKind<'tcx>, decl: &'tcx FnDecl<'_>, body_id: BodyId, _: Span, id: HirId) {
if self.has_unsafe { if self.has_unsafe {
return; return;
} }
@ -438,7 +438,7 @@ impl<'tcx> Visitor<'tcx> for UnsafeVisitor<'_, 'tcx> {
} }
} }
walk_fn(self, kind, decl, body_id, span, id); walk_fn(self, kind, decl, body_id, id);
} }
fn visit_expr(&mut self, expr: &'tcx Expr<'_>) { fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {

View File

@ -70,7 +70,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedAsync {
) { ) {
if !span.from_expansion() && fn_kind.asyncness() == IsAsync::Async { if !span.from_expansion() && fn_kind.asyncness() == IsAsync::Async {
let mut visitor = AsyncFnVisitor { cx, found_await: false }; let mut visitor = AsyncFnVisitor { cx, found_await: false };
walk_fn(&mut visitor, fn_kind, fn_decl, body.id(), span, hir_id); walk_fn(&mut visitor, fn_kind, fn_decl, body.id(), hir_id);
if !visitor.found_await { if !visitor.found_await {
span_lint_and_help( span_lint_and_help(
cx, cx,

View File

@ -326,6 +326,6 @@ impl<'tcx> LateLintPass<'tcx> for Unwrap {
unwrappables: Vec::new(), unwrappables: Vec::new(),
}; };
walk_fn(&mut v, kind, decl, body.id(), span, fn_id); walk_fn(&mut v, kind, decl, body.id(), fn_id);
} }
} }