Remove hir usage from macro_rules! detection in structure_node()

This commit is contained in:
Roland Ruckerbauer
2020-01-12 15:23:04 +01:00
parent 15c5426b54
commit 20b8d283ae
2 changed files with 3 additions and 6 deletions
+1 -2
View File
@@ -58,7 +58,6 @@ fn from(it: $sv) -> $e {
type_ref::Mutability,
};
pub use hir_expand::{
name::name, name::AsName, name::Name, HirFileId, InFile, MacroCallId, MacroCallLoc, MacroDefId,
MacroFile, Origin,
name::Name, HirFileId, InFile, MacroCallId, MacroCallLoc, MacroDefId, MacroFile, Origin,
};
pub use hir_ty::{display::HirDisplay, CallableDef};
+2 -4
View File
@@ -2,7 +2,6 @@
use crate::TextRange;
use hir::{name, AsName, Path};
use ra_syntax::{
ast::{self, AttrsOwner, NameOwner, TypeAscriptionOwner, TypeParamsOwner},
match_ast, AstNode, SourceFile, SyntaxKind, SyntaxNode, WalkEvent,
@@ -152,9 +151,8 @@ fn collapse_ws(node: &SyntaxNode, output: &mut String) {
Some(node)
},
ast::MacroCall(it) => {
match it.path().and_then(|p| Path::from_ast(p)) {
Some(path) if path.mod_path().segments.as_slice() == [name![macro_rules]]
&& it.name().map(|n| n.as_name()).is_some()
match it.path().and_then(|it| it.segment()).and_then(|it| it.name_ref()) {
Some(path_segment) if path_segment.text() == "macro_rules"
=> decl(it),
_ => None,
}