fix: remove trailing space with empty dyn macro arg (#3737)
This commit is contained in:
parent
e653ff03e9
commit
ac150d016b
@ -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);
|
||||
|
@ -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,
|
||||
|
10
tests/source/issue-3709.rs
Normal file
10
tests/source/issue-3709.rs
Normal file
@ -0,0 +1,10 @@
|
||||
// rustfmt-edition: 2018
|
||||
|
||||
macro_rules! token {
|
||||
($t:tt) => {};
|
||||
}
|
||||
|
||||
fn main() {
|
||||
token!(dyn);
|
||||
token!(dyn );
|
||||
}
|
10
tests/target/issue-3709.rs
Normal file
10
tests/target/issue-3709.rs
Normal file
@ -0,0 +1,10 @@
|
||||
// rustfmt-edition: 2018
|
||||
|
||||
macro_rules! token {
|
||||
($t:tt) => {};
|
||||
}
|
||||
|
||||
fn main() {
|
||||
token!(dyn);
|
||||
token!(dyn);
|
||||
}
|
Loading…
Reference in New Issue
Block a user