Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove trailing space inserted with empty dyn macro arg #3737

Merged
merged 1 commit into from
Aug 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/overflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ impl<'a> OverflowableItem<'a> {
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,
Expand Down
10 changes: 10 additions & 0 deletions tests/source/issue-3709.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// rustfmt-edition: 2018

macro_rules! token {
($t:tt) => {};
}

fn main() {
token!(dyn);
token!(dyn );
}
10 changes: 10 additions & 0 deletions tests/target/issue-3709.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// rustfmt-edition: 2018

macro_rules! token {
($t:tt) => {};
}

fn main() {
token!(dyn);
token!(dyn);
}