Skip to content

Commit 9a01e8b

Browse files
committed
Fix rustfmt compile errors
1 parent b0a30d2 commit 9a01e8b

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/tools/rustfmt/src/items.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3449,7 +3449,7 @@ impl Rewrite for ast::ForeignItem {
34493449
ref generics,
34503450
ref body,
34513451
} = **fn_kind;
3452-
if let Some(ref body) = body {
3452+
if body.is_some() {
34533453
let mut visitor = FmtVisitor::from_context(context);
34543454
visitor.block_indent = shape.indent;
34553455
visitor.last_pos = self.span.lo();
@@ -3458,11 +3458,11 @@ impl Rewrite for ast::ForeignItem {
34583458
visitor.visit_fn(
34593459
visit::FnKind::Fn(
34603460
fn_ctxt,
3461-
self.ident,
3461+
&self.ident,
34623462
sig,
34633463
&self.vis,
34643464
generics,
3465-
Some(body),
3465+
body,
34663466
),
34673467
&sig.decl,
34683468
self.span,

src/tools/rustfmt/src/visitor.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
390390
block = b;
391391
self.rewrite_fn_before_block(
392392
indent,
393-
ident,
393+
*ident,
394394
&FnSig::from_fn_kind(&fk, fd, defaultness),
395395
mk_sp(s.lo(), b.span.lo()),
396396
)
@@ -540,7 +540,7 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
540540
ref generics,
541541
ref body,
542542
} = **fn_kind;
543-
if let Some(ref body) = body {
543+
if body.is_some() {
544544
let inner_attrs = inner_attributes(&item.attrs);
545545
let fn_ctxt = match sig.header.ext {
546546
ast::Extern::None => visit::FnCtxt::Free,
@@ -549,11 +549,11 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
549549
self.visit_fn(
550550
visit::FnKind::Fn(
551551
fn_ctxt,
552-
item.ident,
552+
&item.ident,
553553
sig,
554554
&item.vis,
555555
generics,
556-
Some(body),
556+
body,
557557
),
558558
&sig.decl,
559559
item.span,
@@ -648,11 +648,11 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
648648
ref generics,
649649
ref body,
650650
} = **fn_kind;
651-
if let Some(ref body) = body {
651+
if body.is_some() {
652652
let inner_attrs = inner_attributes(&ai.attrs);
653653
let fn_ctxt = visit::FnCtxt::Assoc(assoc_ctxt);
654654
self.visit_fn(
655-
visit::FnKind::Fn(fn_ctxt, ai.ident, sig, &ai.vis, generics, Some(body)),
655+
visit::FnKind::Fn(fn_ctxt, &ai.ident, sig, &ai.vis, generics, body),
656656
&sig.decl,
657657
ai.span,
658658
defaultness,

0 commit comments

Comments
 (0)