mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Use Index
for CrateGraph
This commit is contained in:
parent
57c27f9139
commit
0320ebdd10
9 changed files with 24 additions and 23 deletions
|
@ -54,8 +54,7 @@ pub struct CrateDependency {
|
|||
|
||||
impl Crate {
|
||||
pub fn dependencies(self, db: &impl DefDatabase) -> Vec<CrateDependency> {
|
||||
db.crate_graph()
|
||||
.crate_data(&self.id)
|
||||
db.crate_graph()[self.id]
|
||||
.dependencies
|
||||
.iter()
|
||||
.map(|dep| {
|
||||
|
@ -72,7 +71,7 @@ impl Crate {
|
|||
crate_graph
|
||||
.iter()
|
||||
.filter(|&krate| {
|
||||
crate_graph.crate_data(&krate).dependencies.iter().any(|it| it.crate_id == self.id)
|
||||
crate_graph[krate].dependencies.iter().any(|it| it.crate_id == self.id)
|
||||
})
|
||||
.map(|id| Crate { id })
|
||||
.collect()
|
||||
|
@ -84,11 +83,11 @@ impl Crate {
|
|||
}
|
||||
|
||||
pub fn root_file(self, db: &impl DefDatabase) -> FileId {
|
||||
db.crate_graph().crate_data(&self.id).root_file_id
|
||||
db.crate_graph()[self.id].root_file_id
|
||||
}
|
||||
|
||||
pub fn edition(self, db: &impl DefDatabase) -> Edition {
|
||||
db.crate_graph().crate_data(&self.id).edition
|
||||
db.crate_graph()[self.id].edition
|
||||
}
|
||||
|
||||
pub fn all(db: &impl DefDatabase) -> Vec<Crate> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue