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

View File

@ -58,7 +58,6 @@ pub use hir_def::{
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};

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 structure_node(node: &SyntaxNode) -> Option<StructureNode> {
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,
}