diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-10-12 15:36:14 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-12-11 09:36:40 +1100 |
| commit | 4cfdbd328b7171b2328d11b950b1af0978d6b1ef (patch) | |
| tree | 544de5216adec4838810b031c084a025a787573d /src/tools/rustfmt | |
| parent | 925f7fad576b6a8659d93846faf8d9610e59bab0 (diff) | |
Add spacing information to delimiters.
This is an extension of the previous commit. It means the output of something like this: ``` stringify!(let a: Vec<u32> = vec![];) ``` goes from this: ``` let a: Vec<u32> = vec![] ; ``` With this PR, it now produces this string: ``` let a: Vec<u32> = vec![]; ```
Diffstat (limited to 'src/tools/rustfmt')
| -rw-r--r-- | src/tools/rustfmt/src/macros.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/tools/rustfmt/src/macros.rs b/src/tools/rustfmt/src/macros.rs index 76553466e48..b4c58d2fefb 100644 --- a/src/tools/rustfmt/src/macros.rs +++ b/src/tools/rustfmt/src/macros.rs @@ -708,7 +708,7 @@ struct MacroArgParser { fn last_tok(tt: &TokenTree) -> Token { match *tt { TokenTree::Token(ref t, _) => t.clone(), - TokenTree::Delimited(delim_span, delim, _) => Token { + TokenTree::Delimited(delim_span, _, delim, _) => Token { kind: TokenKind::CloseDelim(delim), span: delim_span.close, }, @@ -925,7 +925,7 @@ impl MacroArgParser { self.add_meta_variable(&mut iter)?; } TokenTree::Token(ref t, _) => self.update_buffer(t), - &TokenTree::Delimited(_delimited_span, delimited, ref tts) => { + &TokenTree::Delimited(_dspan, _spacing, delimited, ref tts) => { if !self.buf.is_empty() { if next_space(&self.last_tok.kind) == SpaceState::Always { self.add_separator(); @@ -1167,7 +1167,7 @@ impl<'a> MacroParser<'a> { let tok = self.toks.next()?; let (lo, args_paren_kind) = match tok { TokenTree::Token(..) => return None, - &TokenTree::Delimited(delimited_span, d, _) => (delimited_span.open.lo(), d), + &TokenTree::Delimited(delimited_span, _, d, _) => (delimited_span.open.lo(), d), }; let args = TokenStream::new(vec![tok.clone()]); match self.toks.next()? { |
