diff options
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r-- | crates/ra_ide/src/expand_macro.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/crates/ra_ide/src/expand_macro.rs b/crates/ra_ide/src/expand_macro.rs index bdbc31704..0f7b6e875 100644 --- a/crates/ra_ide/src/expand_macro.rs +++ b/crates/ra_ide/src/expand_macro.rs | |||
@@ -7,8 +7,7 @@ use rustc_hash::FxHashMap; | |||
7 | 7 | ||
8 | use ra_syntax::{ | 8 | use ra_syntax::{ |
9 | algo::{find_node_at_offset, replace_descendants}, | 9 | algo::{find_node_at_offset, replace_descendants}, |
10 | ast::{self}, | 10 | ast, AstNode, NodeOrToken, SyntaxElement, SyntaxKind, SyntaxNode, WalkEvent, T, |
11 | AstNode, NodeOrToken, SyntaxKind, SyntaxNode, WalkEvent, T, | ||
12 | }; | 11 | }; |
13 | 12 | ||
14 | pub struct ExpandedMacro { | 13 | pub struct ExpandedMacro { |
@@ -43,7 +42,7 @@ fn expand_macro_recur( | |||
43 | let mut expanded: SyntaxNode = db.parse_or_expand(macro_file_id)?; | 42 | let mut expanded: SyntaxNode = db.parse_or_expand(macro_file_id)?; |
44 | 43 | ||
45 | let children = expanded.descendants().filter_map(ast::MacroCall::cast); | 44 | let children = expanded.descendants().filter_map(ast::MacroCall::cast); |
46 | let mut replaces = FxHashMap::default(); | 45 | let mut replaces: FxHashMap<SyntaxElement, SyntaxElement> = FxHashMap::default(); |
47 | 46 | ||
48 | for child in children.into_iter() { | 47 | for child in children.into_iter() { |
49 | let node = hir::InFile::new(macro_file_id, &child); | 48 | let node = hir::InFile::new(macro_file_id, &child); |
@@ -59,7 +58,7 @@ fn expand_macro_recur( | |||
59 | } | 58 | } |
60 | } | 59 | } |
61 | 60 | ||
62 | Some(replace_descendants(&expanded, &replaces)) | 61 | Some(replace_descendants(&expanded, &|n| replaces.get(n).cloned())) |
63 | } | 62 | } |
64 | 63 | ||
65 | // FIXME: It would also be cool to share logic here and in the mbe tests, | 64 | // FIXME: It would also be cool to share logic here and in the mbe tests, |