Skip to content

Commit 68d841e

Browse files
committed
Use is_any_identifier in pretty_print_macro_expansion
1 parent 0339a97 commit 68d841e

File tree

1 file changed

+6
-13
lines changed
  • src/tools/rust-analyzer/crates/hir-def/src/macro_expansion_tests

1 file changed

+6
-13
lines changed

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

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -302,19 +302,12 @@ fn pretty_print_macro_expansion(
302302
(_, T!['{']) => " ",
303303
(T![;] | T!['{'] | T!['}'], _) => "\n",
304304
(_, T!['}']) => "\n",
305-
(IDENT | LIFETIME_IDENT, IDENT | LIFETIME_IDENT) => " ",
306-
_ if prev_kind.is_keyword(Edition::CURRENT)
307-
&& curr_kind.is_keyword(Edition::CURRENT) =>
308-
{
309-
" "
310-
}
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() =>
305+
_ if (prev_kind.is_any_identifier()
306+
|| prev_kind == LIFETIME_IDENT
307+
|| prev_kind.is_literal())
308+
&& (curr_kind.is_any_identifier()
309+
|| curr_kind == LIFETIME_IDENT
310+
|| curr_kind.is_literal()) =>
318311
{
319312
" "
320313
}

0 commit comments

Comments
 (0)