rustc_ast_pretty: Don't print space after $
For example, this code:
$arg:expr
used to be pretty-printed as:
$ arg : expr
but is now pretty-printed as:
$arg : expr
This commit is contained in:
@@ -136,11 +136,11 @@ pub fn print_crate<'a>(
|
|||||||
s.s.eof()
|
s.s.eof()
|
||||||
}
|
}
|
||||||
|
|
||||||
// This makes printed token streams look slightly nicer,
|
/// This makes printed token streams look slightly nicer,
|
||||||
// and also addresses some specific regressions described in #63896 and #73345.
|
/// and also addresses some specific regressions described in #63896 and #73345.
|
||||||
fn tt_prepend_space(tt: &TokenTree, prev: &TokenTree) -> bool {
|
fn tt_prepend_space(tt: &TokenTree, prev: &TokenTree) -> bool {
|
||||||
if let TokenTree::Token(token) = prev {
|
if let TokenTree::Token(token) = prev {
|
||||||
if matches!(token.kind, token::Dot) {
|
if matches!(token.kind, token::Dot | token::Dollar) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if let token::DocComment(comment_kind, ..) = token.kind {
|
if let token::DocComment(comment_kind, ..) = token.kind {
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ macro_rules! matcher_brackets {
|
|||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! all_fragments {
|
macro_rules! all_fragments {
|
||||||
($ b : block, $ e : expr, $ i : ident, $ it : item, $ l : lifetime, $ lit
|
($b : block, $e : expr, $i : ident, $it : item, $l : lifetime, $lit :
|
||||||
: literal, $ m : meta, $ p : pat, $ pth : path, $ s : stmt, $ tt : tt, $
|
literal, $m : meta, $p : pat, $pth : path, $s : stmt, $tt : tt, $ty : ty,
|
||||||
ty : ty, $ vis : vis) => { } ;
|
$vis : vis) => { } ;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|||||||
@@ -14,10 +14,12 @@
|
|||||||
// @has - '//span[@class="op"]' '>'
|
// @has - '//span[@class="op"]' '>'
|
||||||
// @has - '{ ... };'
|
// @has - '{ ... };'
|
||||||
|
|
||||||
// @has - '($ ($'
|
// @has - '($('
|
||||||
// @has - '//span[@class="ident"]' 'arg'
|
// @has - '//span[@class="macro-nonterminal"]' '$'
|
||||||
|
// @has - '//span[@class="macro-nonterminal"]' 'arg'
|
||||||
// @has - ':'
|
// @has - ':'
|
||||||
// @has - '//span[@class="ident"]' 'tt'
|
// @has - '//span[@class="ident"]' 'tt'
|
||||||
|
// @has - '),'
|
||||||
// @has - '//span[@class="op"]' '+'
|
// @has - '//span[@class="op"]' '+'
|
||||||
// @has - ')'
|
// @has - ')'
|
||||||
pub use std::todo;
|
pub use std::todo;
|
||||||
@@ -28,9 +30,11 @@ mod mod1 {
|
|||||||
// @has - 'macro1'
|
// @has - 'macro1'
|
||||||
// @has - '{ ()'
|
// @has - '{ ()'
|
||||||
// @has - '($('
|
// @has - '($('
|
||||||
// @has - 'arg'
|
// @has - '//span[@class="macro-nonterminal"]' '$'
|
||||||
|
// @has - '//span[@class="macro-nonterminal"]' 'arg'
|
||||||
|
// @has - ':'
|
||||||
// @has - 'expr'
|
// @has - 'expr'
|
||||||
// @has - ','
|
// @has - '),'
|
||||||
// @has - '+'
|
// @has - '+'
|
||||||
// @has - ')'
|
// @has - ')'
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
|
|||||||
Reference in New Issue
Block a user