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.
This commit is contained in:
parent
baaa3b6829
commit
5a05b614bf
@ -469,14 +469,15 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
|
|||||||
true,
|
true,
|
||||||
span,
|
span,
|
||||||
),
|
),
|
||||||
MacArgs::Empty | MacArgs::Eq(..) => {
|
MacArgs::Empty => {
|
||||||
self.print_path(&item.path, false, 0);
|
self.print_path(&item.path, false, 0);
|
||||||
if let MacArgs::Eq(_, token) = &item.args {
|
}
|
||||||
self.space();
|
MacArgs::Eq(_, token) => {
|
||||||
self.word_space("=");
|
self.print_path(&item.path, false, 0);
|
||||||
let token_str = self.token_to_string_ext(token, true);
|
self.space();
|
||||||
self.word(token_str);
|
self.word_space("=");
|
||||||
}
|
let token_str = self.token_to_string_ext(token, true);
|
||||||
|
self.word(token_str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.end();
|
self.end();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user