Skip to content

Commit 0339a97

Browse files
committed
Fix spacing for LIFETIME_IDENT near keywords and literals in test output
1 parent 3f4a23e commit 0339a97

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

src/tools/rust-analyzer/crates/hir-def/src/macro_expansion_tests/mbe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2046,7 +2046,7 @@ macro_rules! m {
20462046
($($x:expr)'a*) => (stringify!($($x)'b*));
20472047
}
20482048
fn f() {
2049-
let _ = stringify!(0 'b1 'b2);
2049+
let _ = stringify!(0 'b 1 'b 2);
20502050
}
20512051
"#]],
20522052
);

src/tools/rust-analyzer/crates/hir-def/src/macro_expansion_tests/mbe/regression.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ macro_rules! delegate_impl {
784784
}
785785
}
786786
}
787-
impl <> Data for &'amut G where G: Data {}
787+
impl <> Data for &'a mut G where G: Data {}
788788
"#]],
789789
);
790790
}

src/tools/rust-analyzer/crates/hir-def/src/macro_expansion_tests/mod.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,16 @@ fn pretty_print_macro_expansion(
308308
{
309309
" "
310310
}
311-
(IDENT, _) if curr_kind.is_keyword(Edition::CURRENT) => " ",
312-
(_, IDENT) if prev_kind.is_keyword(Edition::CURRENT) => " ",
311+
(IDENT | LIFETIME_IDENT, _)
312+
if curr_kind.is_keyword(Edition::CURRENT) || curr_kind.is_literal() =>
313+
{
314+
" "
315+
}
316+
(_, IDENT | LIFETIME_IDENT)
317+
if prev_kind.is_keyword(Edition::CURRENT) || prev_kind.is_literal() =>
318+
{
319+
" "
320+
}
313321
(T![>], IDENT) => " ",
314322
(T![>], _) if curr_kind.is_keyword(Edition::CURRENT) => " ",
315323
(T![->], _) | (_, T![->]) => " ",

0 commit comments

Comments
 (0)