mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Remove unused trace module
This commit is contained in:
parent
0ba6f4eda0
commit
d32e60467f
4 changed files with 46 additions and 127 deletions
|
@ -6,10 +6,8 @@ use la_arena::ArenaMap;
|
|||
use syntax::{ast, AstNode, AstPtr};
|
||||
|
||||
use crate::{
|
||||
data::adt::lower_struct,
|
||||
db::DefDatabase,
|
||||
item_tree::{FieldParent, ItemTreeNode},
|
||||
trace::Trace,
|
||||
item_tree::{AttrOwner, FieldParent, ItemTreeNode},
|
||||
GenericDefId, ItemTreeLoc, LocalFieldId, LocalLifetimeParamId, LocalTypeOrConstParamId, Lookup,
|
||||
UseId, VariantId,
|
||||
};
|
||||
|
@ -156,8 +154,49 @@ impl HasChildSource<LocalFieldId> for VariantId {
|
|||
)
|
||||
}
|
||||
};
|
||||
let mut trace = Trace::new_for_map();
|
||||
lower_struct(db, &mut trace, &src, container.krate, &item_tree, parent);
|
||||
src.with_value(trace.into_map())
|
||||
|
||||
let mut map = ArenaMap::new();
|
||||
match &src.value {
|
||||
ast::StructKind::Tuple(fl) => {
|
||||
let cfg_options = &db.crate_graph()[container.krate].cfg_options;
|
||||
let mut idx = 0;
|
||||
for (i, fd) in fl.fields().enumerate() {
|
||||
let attrs = item_tree.attrs(
|
||||
db,
|
||||
container.krate,
|
||||
AttrOwner::make_field_indexed(parent, i),
|
||||
);
|
||||
if !attrs.is_cfg_enabled(cfg_options) {
|
||||
continue;
|
||||
}
|
||||
map.insert(
|
||||
LocalFieldId::from_raw(la_arena::RawIdx::from(idx)),
|
||||
Either::Left(fd.clone()),
|
||||
);
|
||||
idx += 1;
|
||||
}
|
||||
}
|
||||
ast::StructKind::Record(fl) => {
|
||||
let cfg_options = &db.crate_graph()[container.krate].cfg_options;
|
||||
let mut idx = 0;
|
||||
for (i, fd) in fl.fields().enumerate() {
|
||||
let attrs = item_tree.attrs(
|
||||
db,
|
||||
container.krate,
|
||||
AttrOwner::make_field_indexed(parent, i),
|
||||
);
|
||||
if !attrs.is_cfg_enabled(cfg_options) {
|
||||
continue;
|
||||
}
|
||||
map.insert(
|
||||
LocalFieldId::from_raw(la_arena::RawIdx::from(idx)),
|
||||
Either::Right(fd.clone()),
|
||||
);
|
||||
idx += 1;
|
||||
}
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
InFile::new(src.file_id, map)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue