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.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/hir_def/src/macro_expansion_tests.rs b/crates/hir_def/src/macro_expansion_tests.rs
index 3cc3d34cb0..c3fb6fc647 100644
--- a/crates/hir_def/src/macro_expansion_tests.rs
+++ b/crates/hir_def/src/macro_expansion_tests.rs
@@ -20,7 +20,7 @@ use stdx::format_to;
use syntax::{
ast::{self, edit::IndentLevel},
AstNode,
- SyntaxKind::{self, IDENT, LIFETIME_IDENT},
+ SyntaxKind::{EOF, IDENT, LIFETIME_IDENT},
SyntaxNode, T,
};
@@ -109,7 +109,7 @@ fn reindent(indent: IndentLevel, pp: String) -> String {
fn pretty_print_macro_expansion(expn: SyntaxNode) -> String {
let mut res = String::new();
- let mut prev_kind = SyntaxKind::EOF;
+ let mut prev_kind = EOF;
let mut indent_level = 0;
for token in iter::successors(expn.first_token(), |t| t.next_token()) {
let curr_kind = token.kind();
@@ -129,6 +129,8 @@ fn pretty_print_macro_expansion(expn: SyntaxNode) -> String {
(T![->], _) | (_, T![->]) => " ",
(T![&&], _) | (_, T![&&]) => " ",
(T![,], _) => " ",
+ (T![fn], T!['(']) => "",
+ _ if prev_kind.is_keyword() => " ",
_ => "",
};