We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d616a6a commit 1d5c60fCopy full SHA for 1d5c60f
crates/hir_expand/src/input.rs
@@ -1,7 +1,7 @@
1
//! Macro input conditioning.
2
3
use syntax::{
4
- ast::{self, AttrsOwner},
+ ast::{self, make, AttrsOwner},
5
AstNode, SyntaxNode,
6
};
7
@@ -61,7 +61,9 @@ fn remove_attr_invoc(item: ast::Item, attr_index: usize) -> ast::Item {
61
.attrs()
62
.nth(attr_index)
63
.unwrap_or_else(|| panic!("cannot find attribute #{}", attr_index));
64
- attr.syntax().detach();
+ 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()]);
67
item
68
}
69
0 commit comments