Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 20b8d28

Browse files
committed
Remove hir usage from macro_rules! detection in structure_node()
1 parent 15c5426 commit 20b8d28

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

crates/ra_hir/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ pub use hir_def::{
5858
type_ref::Mutability,
5959
};
6060
pub use hir_expand::{
61-
name::name, name::AsName, name::Name, HirFileId, InFile, MacroCallId, MacroCallLoc, MacroDefId,
62-
MacroFile, Origin,
61+
name::Name, HirFileId, InFile, MacroCallId, MacroCallLoc, MacroDefId, MacroFile, Origin,
6362
};
6463
pub use hir_ty::{display::HirDisplay, CallableDef};

crates/ra_ide/src/display/structure.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
33
use crate::TextRange;
44

5-
use hir::{name, AsName, Path};
65
use ra_syntax::{
76
ast::{self, AttrsOwner, NameOwner, TypeAscriptionOwner, TypeParamsOwner},
87
match_ast, AstNode, SourceFile, SyntaxKind, SyntaxNode, WalkEvent,
@@ -152,9 +151,8 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> {
152151
Some(node)
153152
},
154153
ast::MacroCall(it) => {
155-
match it.path().and_then(|p| Path::from_ast(p)) {
156-
Some(path) if path.mod_path().segments.as_slice() == [name![macro_rules]]
157-
&& it.name().map(|n| n.as_name()).is_some()
154+
match it.path().and_then(|it| it.segment()).and_then(|it| it.name_ref()) {
155+
Some(path_segment) if path_segment.text() == "macro_rules"
158156
=> decl(it),
159157
_ => None,
160158
}

0 commit comments

Comments
 (0)