Skip to content

Commit 3567cd0

Browse files
refactor: more visit::FnKind items
1 parent f12d4eb commit 3567cd0

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

rustfmt-core/rustfmt-lib/src/visitor.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -502,12 +502,12 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
502502
ast::ItemKind::Static(..) | ast::ItemKind::Const(..) => {
503503
self.visit_static(&StaticParts::from_item(item));
504504
}
505-
ast::ItemKind::Fn(ref decl, ref fn_header, ref generics, ref body) => {
505+
ast::ItemKind::Fn(ref fn_signature, ref generics, ref body) => {
506506
let inner_attrs = inner_attributes(&item.attrs);
507507
self.visit_fn(
508-
visit::FnKind::ItemFn(item.ident, fn_header, &item.vis, body),
508+
visit::FnKind::ItemFn(item.ident, &fn_signature.header, &item.vis, body),
509509
generics,
510-
decl,
510+
&fn_signature.decl,
511511
item.span,
512512
ast::Defaultness::Final,
513513
Some(&inner_attrs),
@@ -587,8 +587,9 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
587587
}
588588
ast::AssocItemKind::Fn(ref sig, Some(ref body)) => {
589589
let inner_attrs = inner_attributes(&ti.attrs);
590+
let vis = rustc_span::source_map::dummy_spanned(ast::VisibilityKind::Inherited);
590591
self.visit_fn(
591-
visit::FnKind::Method(ti.ident, sig, None, body),
592+
visit::FnKind::Method(ti.ident, sig, &vis, body),
592593
&ti.generics,
593594
&sig.decl,
594595
ti.span,
@@ -625,7 +626,7 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
625626
ast::AssocItemKind::Fn(ref sig, Some(ref body)) => {
626627
let inner_attrs = inner_attributes(&ii.attrs);
627628
self.visit_fn(
628-
visit::FnKind::Fn(ii.ident, sig, Some(&ii.vis), body),
629+
visit::FnKind::Method(ii.ident, sig, &ii.vis, body),
629630
&ii.generics,
630631
&sig.decl,
631632
ii.span,

0 commit comments

Comments
 (0)