From 20b8d283ae7d18faaa8aec86e029a573e755a1dd Mon Sep 17 00:00:00 2001 From: Roland Ruckerbauer Date: Sun, 12 Jan 2020 15:23:04 +0100 Subject: Remove hir usage from macro_rules! detection in structure_node() --- crates/ra_hir/src/lib.rs | 3 +-- crates/ra_ide/src/display/structure.rs | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs index 94da70cca..3d13978d4 100644 --- a/crates/ra_hir/src/lib.rs +++ b/crates/ra_hir/src/lib.rs @@ -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}; diff --git a/crates/ra_ide/src/display/structure.rs b/crates/ra_ide/src/display/structure.rs index fdd589648..944cc79df 100644 --- a/crates/ra_ide/src/display/structure.rs +++ b/crates/ra_ide/src/display/structure.rs @@ -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 { 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, } -- cgit v1.2.3