mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
Simplify
This commit is contained in:
parent
d9f5709609
commit
a6c067c06d
14 changed files with 89 additions and 88 deletions
|
@ -110,14 +110,17 @@ impl ProjectJson {
|
|||
.collect::<Vec<_>>(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the number of crates in the project.
|
||||
pub fn n_crates(&self) -> usize {
|
||||
self.crates.len()
|
||||
}
|
||||
|
||||
/// Returns an iterator over the crates in the project.
|
||||
pub fn crates(&self) -> impl Iterator<Item = (CrateId, &Crate)> + '_ {
|
||||
self.crates.iter().enumerate().map(|(idx, krate)| (CrateId(idx as u32), krate))
|
||||
}
|
||||
|
||||
/// Returns the path to the project's root folder.
|
||||
pub fn path(&self) -> &AbsPath {
|
||||
&self.project_root
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue