Use Index for CrateGraph
This commit is contained in:
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user