diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/hir_expand/src/input.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/hir_expand/src/input.rs b/crates/hir_expand/src/input.rs index 40116a479..82dc7f326 100644 --- a/crates/hir_expand/src/input.rs +++ b/crates/hir_expand/src/input.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! Macro input conditioning. | 1 | //! Macro input conditioning. |
2 | 2 | ||
3 | use syntax::{ | 3 | use syntax::{ |
4 | ast::{self, AttrsOwner}, | 4 | ast::{self, make, AttrsOwner}, |
5 | AstNode, SyntaxNode, | 5 | AstNode, SyntaxNode, |
6 | }; | 6 | }; |
7 | 7 | ||
@@ -61,7 +61,9 @@ fn remove_attr_invoc(item: ast::Item, attr_index: usize) -> ast::Item { | |||
61 | .attrs() | 61 | .attrs() |
62 | .nth(attr_index) | 62 | .nth(attr_index) |
63 | .unwrap_or_else(|| panic!("cannot find attribute #{}", attr_index)); | 63 | .unwrap_or_else(|| panic!("cannot find attribute #{}", attr_index)); |
64 | attr.syntax().detach(); | 64 | let syntax_index = attr.syntax().index(); |
65 | let ws = make::tokens::whitespace(&" ".repeat(u32::from(attr.syntax().text().len()) as usize)); | ||
66 | item.syntax().splice_children(syntax_index..syntax_index + 1, vec![ws.into()]); | ||
65 | item | 67 | item |
66 | } | 68 | } |
67 | 69 | ||