Skip to content

Commit 5a05b61

Browse files
committed
Tweak print_attr_item.
This commit rearranges the `match`. The new code avoids testing for `MacArgs::Eq` twice, at the cost of repeating the `self.print_path()` call. I think this is worthwhile because it puts the `match` in a more standard and readable form.
1 parent baaa3b6 commit 5a05b61

File tree

1 file changed

+8
-7
lines changed
  • compiler/rustc_ast_pretty/src/pprust

1 file changed

+8
-7
lines changed

compiler/rustc_ast_pretty/src/pprust/state.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -469,14 +469,15 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
469469
true,
470470
span,
471471
),
472-
MacArgs::Empty | MacArgs::Eq(..) => {
472+
MacArgs::Empty => {
473473
self.print_path(&item.path, false, 0);
474-
if let MacArgs::Eq(_, token) = &item.args {
475-
self.space();
476-
self.word_space("=");
477-
let token_str = self.token_to_string_ext(token, true);
478-
self.word(token_str);
479-
}
474+
}
475+
MacArgs::Eq(_, token) => {
476+
self.print_path(&item.path, false, 0);
477+
self.space();
478+
self.word_space("=");
479+
let token_str = self.token_to_string_ext(token, true);
480+
self.word(token_str);
480481
}
481482
}
482483
self.end();

0 commit comments

Comments
 (0)