mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Move hir_def::builtin_attr to hir_def::attr::builtin
This commit is contained in:
parent
12b069f434
commit
3f5c9920d6
5 changed files with 12 additions and 12 deletions
|
@ -109,8 +109,7 @@ pub use crate::{
|
|||
pub use {
|
||||
cfg::{CfgAtom, CfgExpr, CfgOptions},
|
||||
hir_def::{
|
||||
attr::{Attrs, AttrsWithOwner, Documentation},
|
||||
builtin_attr::AttributeTemplate,
|
||||
attr::{builtin::AttributeTemplate, Attrs, AttrsWithOwner, Documentation},
|
||||
data::adt::StructKind,
|
||||
find_path::PrefixKind,
|
||||
import_map,
|
||||
|
@ -2697,7 +2696,7 @@ impl BuiltinAttr {
|
|||
}
|
||||
|
||||
fn builtin(name: &str) -> Option<Self> {
|
||||
hir_def::builtin_attr::find_builtin_attr_idx(name)
|
||||
hir_def::attr::builtin::find_builtin_attr_idx(name)
|
||||
.map(|idx| BuiltinAttr { krate: None, idx: idx as u32 })
|
||||
}
|
||||
|
||||
|
@ -2705,14 +2704,14 @@ impl BuiltinAttr {
|
|||
// FIXME: Return a `Name` here
|
||||
match self.krate {
|
||||
Some(krate) => db.crate_def_map(krate).registered_attrs()[self.idx as usize].clone(),
|
||||
None => SmolStr::new(hir_def::builtin_attr::INERT_ATTRIBUTES[self.idx as usize].name),
|
||||
None => SmolStr::new(hir_def::attr::builtin::INERT_ATTRIBUTES[self.idx as usize].name),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn template(&self, _: &dyn HirDatabase) -> Option<AttributeTemplate> {
|
||||
match self.krate {
|
||||
Some(_) => None,
|
||||
None => Some(hir_def::builtin_attr::INERT_ATTRIBUTES[self.idx as usize].template),
|
||||
None => Some(hir_def::attr::builtin::INERT_ATTRIBUTES[self.idx as usize].template),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2735,7 +2734,7 @@ impl ToolModule {
|
|||
}
|
||||
|
||||
fn builtin(name: &str) -> Option<Self> {
|
||||
hir_def::builtin_attr::TOOL_MODULES
|
||||
hir_def::attr::builtin::TOOL_MODULES
|
||||
.iter()
|
||||
.position(|&tool| tool == name)
|
||||
.map(|idx| ToolModule { krate: None, idx: idx as u32 })
|
||||
|
@ -2745,7 +2744,7 @@ impl ToolModule {
|
|||
// FIXME: Return a `Name` here
|
||||
match self.krate {
|
||||
Some(krate) => db.crate_def_map(krate).registered_tools()[self.idx as usize].clone(),
|
||||
None => SmolStr::new(hir_def::builtin_attr::TOOL_MODULES[self.idx as usize]),
|
||||
None => SmolStr::new(hir_def::attr::builtin::TOOL_MODULES[self.idx as usize]),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue