Skip to content

Commit 66c2b77

Browse files
committed
Rename tt_prepend_space as space_between.
And reorder the arguments. I find it easier to think about this way.
1 parent 33aff5b commit 66c2b77

File tree

1 file changed

+4
-4
lines changed
  • compiler/rustc_ast_pretty/src/pprust

1 file changed

+4
-4
lines changed

compiler/rustc_ast_pretty/src/pprust/state.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ pub fn print_crate<'a>(
148148

149149
/// This makes printed token streams look slightly nicer,
150150
/// and also addresses some specific regressions described in #63896 and #73345.
151-
fn tt_prepend_space(tt: &TokenTree, prev: &TokenTree) -> bool {
151+
fn space_between(prev: &TokenTree, curr: &TokenTree) -> bool {
152152
if let TokenTree::Token(token, _) = prev {
153153
// No space after these tokens, e.g. `x.y`, `$e`
154154
// (The carets point to `prev`.) ^ ^
@@ -159,9 +159,9 @@ fn tt_prepend_space(tt: &TokenTree, prev: &TokenTree) -> bool {
159159
return comment_kind != CommentKind::Line;
160160
}
161161
}
162-
match tt {
162+
match curr {
163163
// No space before these tokens, e.g. `foo,`, `println!`, `x.y`
164-
// (The carets point to `token`.) ^ ^ ^
164+
// (The carets point to `curr`.) ^ ^ ^
165165
//
166166
// FIXME: having `Not` here works well for macro invocations like
167167
// `println!()`, but is bad when `!` means "logical not" or "the never
@@ -575,7 +575,7 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
575575
while let Some(tt) = iter.next() {
576576
self.print_tt(tt, convert_dollar_crate);
577577
if let Some(next) = iter.peek() {
578-
if tt_prepend_space(next, tt) {
578+
if space_between(tt, next) {
579579
self.space();
580580
}
581581
}

0 commit comments

Comments
 (0)