Skip to content

Commit 3a1a00f

Browse files
committed
Keep delimiter as part of macro args list
1 parent 76137dd commit 3a1a00f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/macros.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ pub fn rewrite_macro_def(
324324
return snippet;
325325
}
326326

327-
let args = format!("({})", format_macro_args(branch.args)?);
327+
let args = format_macro_args(branch.args)?;
328328

329329
if multi_branch_style {
330330
result += "\n";
@@ -755,10 +755,12 @@ impl MacroParser {
755755

756756
// `(` ... `)` `=>` `{` ... `}`
757757
fn parse_branch(&mut self) -> Option<MacroBranch> {
758-
let (args_paren_kind, args) = match self.toks.next()? {
758+
let tok = self.toks.next()?;
759+
let args_paren_kind = match tok {
759760
TokenTree::Token(..) => return None,
760-
TokenTree::Delimited(_, ref d) => (d.delim, d.tts.clone().into()),
761+
TokenTree::Delimited(_, ref d) => d.delim,
761762
};
763+
let args = tok.joint().into();
762764
match self.toks.next()? {
763765
TokenTree::Token(_, Token::FatArrow) => {}
764766
_ => return None,

0 commit comments

Comments
 (0)