Skip to content

Commit 40c068f

Browse files
committed
Use hir_def::builtin_attr::find_builtin_attr_idx
1 parent 99b6952 commit 40c068f

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

crates/hir-def/src/nameres/attr_resolution.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,9 @@ impl DefMap {
8383
}
8484

8585
if segments.len() == 1 {
86-
let registered = self.registered_attrs.iter().map(SmolStr::as_str);
87-
let is_inert = builtin_attr::INERT_ATTRIBUTES
88-
.iter()
89-
.map(|it| it.name)
90-
.chain(registered)
91-
.any(pred);
86+
let mut registered = self.registered_attrs.iter().map(SmolStr::as_str);
87+
let is_inert =
88+
builtin_attr::find_builtin_attr_idx(&name).is_some() || registered.any(pred);
9289
return is_inert;
9390
}
9491
}

crates/hir/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2697,9 +2697,7 @@ impl BuiltinAttr {
26972697
}
26982698

26992699
fn builtin(name: &str) -> Option<Self> {
2700-
hir_def::builtin_attr::INERT_ATTRIBUTES
2701-
.iter()
2702-
.position(|tool| tool.name == name)
2700+
hir_def::builtin_attr::find_builtin_attr_idx(name)
27032701
.map(|idx| BuiltinAttr { krate: None, idx: idx as u32 })
27042702
}
27052703

0 commit comments

Comments
 (0)