fix: remove trailing space with empty dyn macro arg (#3737)

This commit is contained in:
Caleb Cartwright 2019-08-10 22:49:14 -05:00 committed by Seiichi Uchida
parent e653ff03e9
commit ac150d016b
4 changed files with 23 additions and 2 deletions

View File

@ -303,9 +303,9 @@ fn rewrite_macro_inner(
if DelimToken::Brace != style {
loop {
if let Some(arg) = parse_macro_arg(&mut parser) {
if let Some(arg) = check_keyword(&mut parser) {
arg_vec.push(arg);
} else if let Some(arg) = check_keyword(&mut parser) {
} else if let Some(arg) = parse_macro_arg(&mut parser) {
arg_vec.push(arg);
} else {
return return_macro_parse_failure_fallback(context, shape.indent, mac.span);

View File

@ -122,6 +122,7 @@ pub(crate) fn map<F, T>(&self, f: F) -> T
pub(crate) fn is_simple(&self) -> bool {
match self {
OverflowableItem::Expr(expr) => is_simple_expr(expr),
OverflowableItem::MacroArg(MacroArg::Keyword(..)) => true,
OverflowableItem::MacroArg(MacroArg::Expr(expr)) => is_simple_expr(expr),
OverflowableItem::NestedMetaItem(nested_meta_item) => match nested_meta_item {
ast::NestedMetaItem::Literal(..) => true,

View File

@ -0,0 +1,10 @@
// rustfmt-edition: 2018
macro_rules! token {
($t:tt) => {};
}
fn main() {
token!(dyn);
token!(dyn );
}

View File

@ -0,0 +1,10 @@
// rustfmt-edition: 2018
macro_rules! token {
($t:tt) => {};
}
fn main() {
token!(dyn);
token!(dyn);
}