Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir_def/src/macro_expansion_tests.rs')
| -rw-r--r-- | crates/hir_def/src/macro_expansion_tests.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/crates/hir_def/src/macro_expansion_tests.rs b/crates/hir_def/src/macro_expansion_tests.rs index d96af5c407..60c9fd7d0a 100644 --- a/crates/hir_def/src/macro_expansion_tests.rs +++ b/crates/hir_def/src/macro_expansion_tests.rs @@ -123,6 +123,9 @@ fn pretty_print_macro_expansion(expn: SyntaxNode) -> String { (IDENT | LIFETIME_IDENT, IDENT | LIFETIME_IDENT) => " ", (IDENT, _) if curr_kind.is_keyword() => " ", (_, IDENT) if prev_kind.is_keyword() => " ", + (T![>], IDENT) => " ", + (T![>], _) if curr_kind.is_keyword() => " ", + (T![->], _) | (_, T![->]) => " ", _ => "", }; @@ -133,8 +136,9 @@ fn pretty_print_macro_expansion(expn: SyntaxNode) -> String { } res.push_str(space); - if space == "\n" && curr_kind != T!['}'] { - res.push_str(&" ".repeat(indent_level)); + if space == "\n" { + let level = if curr_kind == T!['}'] { indent_level - 1 } else { indent_level }; + res.push_str(&" ".repeat(level)); } prev_kind = curr_kind; format_to!(res, "{}", token) |