Skip to content

Commit e1d2d8f

Browse files
committed
refactor(source): Remove superfluous recursive field
1 parent b888464 commit e1d2d8f

File tree

1 file changed

+1
-24
lines changed

1 file changed

+1
-24
lines changed

src/cargo/sources/path.rs

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ pub struct PathSource<'gctx> {
3434
updated: bool,
3535
/// Packages that this sources has discovered.
3636
packages: Vec<Package>,
37-
/// Whether this source should discover nested packages recursively.
38-
recursive: bool,
3937
gctx: &'gctx GlobalContext,
4038
}
4139

@@ -51,15 +49,13 @@ impl<'gctx> PathSource<'gctx> {
5149
updated: false,
5250
packages: Vec::new(),
5351
gctx,
54-
recursive: false,
5552
}
5653
}
5754

5855
/// Preloads a package for this source. The source is assumed that it has
5956
/// yet loaded any other packages.
6057
pub fn preload_with(&mut self, pkg: Package) {
6158
assert!(!self.updated);
62-
assert!(!self.recursive);
6359
assert!(self.packages.is_empty());
6460
self.updated = true;
6561
self.packages.push(pkg);
@@ -85,8 +81,6 @@ impl<'gctx> PathSource<'gctx> {
8581
pub fn read_packages(&self) -> CargoResult<Vec<Package>> {
8682
if self.updated {
8783
Ok(self.packages.clone())
88-
} else if self.recursive {
89-
ops::read_packages(&self.path, self.source_id, self.gctx)
9084
} else {
9185
let path = self.path.join("Cargo.toml");
9286
let pkg = ops::read_package(&path, self.source_id, self.gctx)?;
@@ -234,8 +228,6 @@ pub struct RecursivePathSource<'gctx> {
234228
updated: bool,
235229
/// Packages that this sources has discovered.
236230
packages: Vec<Package>,
237-
/// Whether this source should discover nested packages recursively.
238-
recursive: bool,
239231
gctx: &'gctx GlobalContext,
240232
}
241233

@@ -255,20 +247,9 @@ impl<'gctx> RecursivePathSource<'gctx> {
255247
updated: false,
256248
packages: Vec::new(),
257249
gctx,
258-
recursive: true,
259250
}
260251
}
261252

262-
/// Preloads a package for this source. The source is assumed that it has
263-
/// yet loaded any other packages.
264-
pub fn preload_with(&mut self, pkg: Package) {
265-
assert!(!self.updated);
266-
assert!(!self.recursive);
267-
assert!(self.packages.is_empty());
268-
self.updated = true;
269-
self.packages.push(pkg);
270-
}
271-
272253
/// Gets the package on the root path.
273254
pub fn root_package(&mut self) -> CargoResult<Package> {
274255
trace!("root_package; source={:?}", self);
@@ -289,12 +270,8 @@ impl<'gctx> RecursivePathSource<'gctx> {
289270
pub fn read_packages(&self) -> CargoResult<Vec<Package>> {
290271
if self.updated {
291272
Ok(self.packages.clone())
292-
} else if self.recursive {
293-
ops::read_packages(&self.path, self.source_id, self.gctx)
294273
} else {
295-
let path = self.path.join("Cargo.toml");
296-
let pkg = ops::read_package(&path, self.source_id, self.gctx)?;
297-
Ok(vec![pkg])
274+
ops::read_packages(&self.path, self.source_id, self.gctx)
298275
}
299276
}
300277

0 commit comments

Comments
 (0)