mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
refactor(path): Clarify the relationship between read_packages and update
This commit is contained in:
parent
814f91854a
commit
f3adda2806
@ -264,10 +264,14 @@ impl<'gctx> RecursivePathSource<'gctx> {
|
|||||||
if self.updated {
|
if self.updated {
|
||||||
Ok(self.packages.clone())
|
Ok(self.packages.clone())
|
||||||
} else {
|
} else {
|
||||||
ops::read_packages(&self.path, self.source_id, self.gctx)
|
self.read_packages_inner()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn read_packages_inner(&self) -> CargoResult<Vec<Package>> {
|
||||||
|
ops::read_packages(&self.path, self.source_id, self.gctx)
|
||||||
|
}
|
||||||
|
|
||||||
/// List all files relevant to building this package inside this source.
|
/// List all files relevant to building this package inside this source.
|
||||||
///
|
///
|
||||||
/// This function will use the appropriate methods to determine the
|
/// This function will use the appropriate methods to determine the
|
||||||
@ -301,7 +305,7 @@ impl<'gctx> RecursivePathSource<'gctx> {
|
|||||||
/// Discovers packages inside this source if it hasn't yet done.
|
/// Discovers packages inside this source if it hasn't yet done.
|
||||||
pub fn update(&mut self) -> CargoResult<()> {
|
pub fn update(&mut self) -> CargoResult<()> {
|
||||||
if !self.updated {
|
if !self.updated {
|
||||||
let packages = self.read_packages()?;
|
let packages = self.read_packages_inner()?;
|
||||||
self.packages.extend(packages.into_iter());
|
self.packages.extend(packages.into_iter());
|
||||||
self.updated = true;
|
self.updated = true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user