Skip to content

Commit

Permalink
Keep delimiter as part of macro args list
Browse files Browse the repository at this point in the history
  • Loading branch information
RReverser committed Jan 28, 2018
1 parent 76137dd commit 3a1a00f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ pub fn rewrite_macro_def(
return snippet;
}

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

if multi_branch_style {
result += "\n";
Expand Down Expand Up @@ -755,10 +755,12 @@ impl MacroParser {

// `(` ... `)` `=>` `{` ... `}`
fn parse_branch(&mut self) -> Option<MacroBranch> {
let (args_paren_kind, args) = match self.toks.next()? {
let tok = self.toks.next()?;
let args_paren_kind = match tok {
TokenTree::Token(..) => return None,
TokenTree::Delimited(_, ref d) => (d.delim, d.tts.clone().into()),
TokenTree::Delimited(_, ref d) => d.delim,
};
let args = tok.joint().into();
match self.toks.next()? {
TokenTree::Token(_, Token::FatArrow) => {}
_ => return None,
Expand Down

0 comments on commit 3a1a00f

Please sign in to comment.