Skip to content

Commit 925363f

Browse files
committed
Remove unused span argument from walk_fn.
1 parent 6568ef3 commit 925363f

File tree

13 files changed

+22
-23
lines changed

13 files changed

+22
-23
lines changed

compiler/rustc_ast/src/visit.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ pub trait Visitor<'ast>: Sized {
156156
fn visit_where_predicate(&mut self, p: &'ast WherePredicate) {
157157
walk_where_predicate(self, p)
158158
}
159-
fn visit_fn(&mut self, fk: FnKind<'ast>, s: Span, _: NodeId) {
160-
walk_fn(self, fk, s)
159+
fn visit_fn(&mut self, fk: FnKind<'ast>, _: Span, _: NodeId) {
160+
walk_fn(self, fk)
161161
}
162162
fn visit_assoc_item(&mut self, i: &'ast AssocItem, ctxt: AssocCtxt) {
163163
walk_assoc_item(self, i, ctxt)
@@ -655,7 +655,7 @@ pub fn walk_fn_decl<'a, V: Visitor<'a>>(visitor: &mut V, function_declaration: &
655655
visitor.visit_fn_ret_ty(&function_declaration.output);
656656
}
657657

658-
pub fn walk_fn<'a, V: Visitor<'a>>(visitor: &mut V, kind: FnKind<'a>, _span: Span) {
658+
pub fn walk_fn<'a, V: Visitor<'a>>(visitor: &mut V, kind: FnKind<'a>) {
659659
match kind {
660660
FnKind::Fn(_, _, sig, _, generics, body) => {
661661
visitor.visit_generics(generics);

compiler/rustc_ast_lowering/src/index.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -279,12 +279,12 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
279279
fk: intravisit::FnKind<'hir>,
280280
fd: &'hir FnDecl<'hir>,
281281
b: BodyId,
282-
s: Span,
282+
_: Span,
283283
id: HirId,
284284
) {
285285
assert_eq!(self.owner, id.owner);
286286
assert_eq!(self.parent_node, id.local_id);
287-
intravisit::walk_fn(self, fk, fd, b, s, id);
287+
intravisit::walk_fn(self, fk, fd, b, id);
288288
}
289289

290290
fn visit_block(&mut self, block: &'hir Block<'hir>) {

compiler/rustc_ast_passes/src/ast_validation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1527,7 +1527,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
15271527
matches!(fk.header(), Some(FnHeader { constness: Const::Yes(_), .. }))
15281528
|| matches!(fk.ctxt(), Some(FnCtxt::Assoc(_)));
15291529

1530-
self.with_tilde_const(tilde_const_allowed, |this| visit::walk_fn(this, fk, span));
1530+
self.with_tilde_const(tilde_const_allowed, |this| visit::walk_fn(this, fk));
15311531
}
15321532

15331533
fn visit_assoc_item(&mut self, item: &'a AssocItem, ctxt: AssocCtxt) {

compiler/rustc_ast_passes/src/feature_gate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
699699
gate_feature_post!(&self, c_variadic, span, "C-variadic functions are unstable");
700700
}
701701

702-
visit::walk_fn(self, fn_kind, span)
702+
visit::walk_fn(self, fn_kind)
703703
}
704704

705705
fn visit_assoc_constraint(&mut self, constraint: &'a AssocConstraint) {

compiler/rustc_ast_passes/src/node_count.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ impl<'ast> Visitor<'ast> for NodeCounter {
6363
self.count += 1;
6464
walk_generics(self, g)
6565
}
66-
fn visit_fn(&mut self, fk: visit::FnKind<'_>, s: Span, _: NodeId) {
66+
fn visit_fn(&mut self, fk: visit::FnKind<'_>, _: Span, _: NodeId) {
6767
self.count += 1;
68-
walk_fn(self, fk, s)
68+
walk_fn(self, fk)
6969
}
7070
fn visit_assoc_item(&mut self, ti: &AssocItem, ctxt: AssocCtxt) {
7171
self.count += 1;

compiler/rustc_hir/src/intravisit.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,8 @@ pub trait Visitor<'v>: Sized {
361361
fn visit_fn_decl(&mut self, fd: &'v FnDecl<'v>) {
362362
walk_fn_decl(self, fd)
363363
}
364-
fn visit_fn(&mut self, fk: FnKind<'v>, fd: &'v FnDecl<'v>, b: BodyId, s: Span, id: HirId) {
365-
walk_fn(self, fk, fd, b, s, id)
364+
fn visit_fn(&mut self, fk: FnKind<'v>, fd: &'v FnDecl<'v>, b: BodyId, _: Span, id: HirId) {
365+
walk_fn(self, fk, fd, b, id)
366366
}
367367
fn visit_use(&mut self, path: &'v Path<'v>, hir_id: HirId) {
368368
walk_use(self, path, hir_id)
@@ -898,7 +898,6 @@ pub fn walk_fn<'v, V: Visitor<'v>>(
898898
function_kind: FnKind<'v>,
899899
function_declaration: &'v FnDecl<'v>,
900900
body_id: BodyId,
901-
_span: Span,
902901
id: HirId,
903902
) {
904903
visitor.visit_id(id);

compiler/rustc_lint/src/early.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>
147147
fn visit_fn(&mut self, fk: ast_visit::FnKind<'a>, span: Span, id: ast::NodeId) {
148148
run_early_pass!(self, check_fn, fk, span, id);
149149
self.check_id(id);
150-
ast_visit::walk_fn(self, fk, span);
150+
ast_visit::walk_fn(self, fk);
151151

152152
// Explicitly check for lints associated with 'closure_id', since
153153
// it does not have a corresponding AST node

compiler/rustc_lint/src/late.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ impl<'tcx, T: LateLintPass<'tcx>> hir_visit::Visitor<'tcx> for LateContextAndPas
187187
let old_cached_typeck_results = self.context.cached_typeck_results.take();
188188
let body = self.context.tcx.hir().body(body_id);
189189
lint_callback!(self, check_fn, fk, decl, body, span, id);
190-
hir_visit::walk_fn(self, fk, decl, body_id, span, id);
190+
hir_visit::walk_fn(self, fk, decl, body_id, id);
191191
self.context.enclosing_body = old_enclosing_body;
192192
self.context.cached_typeck_results.set(old_cached_typeck_results);
193193
}

compiler/rustc_passes/src/hir_stats.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -362,11 +362,11 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
362362
fk: hir_visit::FnKind<'v>,
363363
fd: &'v hir::FnDecl<'v>,
364364
b: hir::BodyId,
365-
s: Span,
365+
_: Span,
366366
id: hir::HirId,
367367
) {
368368
self.record("FnDecl", Id::None, fd);
369-
hir_visit::walk_fn(self, fk, fd, b, s, id)
369+
hir_visit::walk_fn(self, fk, fd, b, id)
370370
}
371371

372372
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> {
612612
ast_visit::walk_where_predicate(self, p)
613613
}
614614

615-
fn visit_fn(&mut self, fk: ast_visit::FnKind<'v>, s: Span, _: NodeId) {
615+
fn visit_fn(&mut self, fk: ast_visit::FnKind<'v>, _: Span, _: NodeId) {
616616
self.record("FnDecl", Id::None, fk.decl());
617-
ast_visit::walk_fn(self, fk, s)
617+
ast_visit::walk_fn(self, fk)
618618
}
619619

620620
fn visit_assoc_item(&mut self, i: &'v ast::AssocItem, ctxt: ast_visit::AssocCtxt) {

compiler/rustc_resolve/src/def_collector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ impl<'a, 'b> visit::Visitor<'a> for DefCollector<'a, 'b> {
154154
}
155155
}
156156

157-
visit::walk_fn(self, fn_kind, span);
157+
visit::walk_fn(self, fn_kind);
158158
}
159159

160160
fn visit_use_tree(&mut self, use_tree: &'a UseTree, id: NodeId, _nested: bool) {

src/tools/clippy/clippy_lints/src/derive.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ struct UnsafeVisitor<'a, 'tcx> {
425425
impl<'tcx> Visitor<'tcx> for UnsafeVisitor<'_, 'tcx> {
426426
type NestedFilter = nested_filter::All;
427427

428-
fn visit_fn(&mut self, kind: FnKind<'tcx>, decl: &'tcx FnDecl<'_>, body_id: BodyId, span: Span, id: HirId) {
428+
fn visit_fn(&mut self, kind: FnKind<'tcx>, decl: &'tcx FnDecl<'_>, body_id: BodyId, _: Span, id: HirId) {
429429
if self.has_unsafe {
430430
return;
431431
}
@@ -438,7 +438,7 @@ impl<'tcx> Visitor<'tcx> for UnsafeVisitor<'_, 'tcx> {
438438
}
439439
}
440440

441-
walk_fn(self, kind, decl, body_id, span, id);
441+
walk_fn(self, kind, decl, body_id, id);
442442
}
443443

444444
fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {

src/tools/clippy/clippy_lints/src/unused_async.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedAsync {
7070
) {
7171
if !span.from_expansion() && fn_kind.asyncness() == IsAsync::Async {
7272
let mut visitor = AsyncFnVisitor { cx, found_await: false };
73-
walk_fn(&mut visitor, fn_kind, fn_decl, body.id(), span, hir_id);
73+
walk_fn(&mut visitor, fn_kind, fn_decl, body.id(), hir_id);
7474
if !visitor.found_await {
7575
span_lint_and_help(
7676
cx,

src/tools/clippy/clippy_lints/src/unwrap.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,6 @@ impl<'tcx> LateLintPass<'tcx> for Unwrap {
326326
unwrappables: Vec::new(),
327327
};
328328

329-
walk_fn(&mut v, kind, decl, body.id(), span, fn_id);
329+
walk_fn(&mut v, kind, decl, body.id(), fn_id);
330330
}
331331
}

0 commit comments

Comments
 (0)