From ee5fdf7b861961013d9c996159a67778f58499fb Mon Sep 17 00:00:00 2001 From: Matthieu Pizenberg Date: Fri, 13 Nov 2020 22:56:33 +0100 Subject: [PATCH] refactor: rename packages to potential_packages --- src/solver.rs | 10 +++++----- tests/proptest.rs | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/solver.rs b/src/solver.rs index ba63fe4c..7c9647eb 100644 --- a/src/solver.rs +++ b/src/solver.rs @@ -226,7 +226,7 @@ pub trait DependencyProvider { /// Note: the type `T` ensures that this returns an item from the `packages` argument. fn make_decision, U: Borrow>>( &self, - packages: impl Iterator, + potential_packages: impl Iterator, ) -> Result<(T, Option), Box>; /// Retrieves the package dependencies. @@ -255,7 +255,7 @@ pub trait DependencyProvider { /// first version contained in the constraints. pub fn make_fewest_versions_decision_helper( list_available_versions: F, - packages: impl Iterator, + potential_packages: impl Iterator, ) -> (T, Option) where T: Borrow

, @@ -265,7 +265,7 @@ where { let mut package: Option<(T, _)> = None; let mut min_key = usize::MAX; - for (p, term) in packages { + for (p, term) in potential_packages { let key = list_available_versions(p.borrow()) .filter(|v| term.borrow().contains(v.borrow())) .count(); @@ -348,7 +348,7 @@ impl OfflineDependencyProvider { impl DependencyProvider for OfflineDependencyProvider { fn make_decision, U: Borrow>>( &self, - packages: impl Iterator, + potential_packages: impl Iterator, ) -> Result<(T, Option), Box> { Ok(make_fewest_versions_decision_helper( |p| { @@ -359,7 +359,7 @@ impl DependencyProvider for OfflineDependencyProvi .rev() .cloned() }, - packages, + potential_packages, )) } diff --git a/tests/proptest.rs b/tests/proptest.rs index 05467417..82bbe3cd 100644 --- a/tests/proptest.rs +++ b/tests/proptest.rs @@ -29,11 +29,11 @@ struct OldestVersionsDependencyProvider(OfflineDependenc impl DependencyProvider for OldestVersionsDependencyProvider { fn make_decision, U: std::borrow::Borrow>>( &self, - packages: impl Iterator, + potential_packages: impl Iterator, ) -> Result<(T, Option), Box> { Ok(make_fewest_versions_decision_helper( |p| self.0.versions(p).into_iter().flatten().cloned(), - packages, + potential_packages, )) } @@ -67,9 +67,9 @@ impl> DependencyProvider, U: std::borrow::Borrow>>( &self, - packages: impl Iterator, + potential_packages: impl Iterator, ) -> Result<(T, Option), Box> { - self.dp.make_decision(packages) + self.dp.make_decision(potential_packages) } fn get_dependencies(&self, p: &P, v: &V) -> Result, Box> {