|
1 | 1 | use crate::resolvo::{CondaDependencyProvider, SolverMatchSpec};
|
| 2 | +use futures::future::FutureExt; |
2 | 3 | use rattler_conda_types::Version;
|
3 | 4 | use resolvo::{Dependencies, SolvableId, SolverCache, VersionSetId};
|
4 | 5 | use std::cmp::Ordering;
|
5 | 6 | use std::collections::HashMap;
|
6 |
| -use futures::future::FutureExt; |
7 | 7 | /// Returns the order of two candidates based on the order used by conda.
|
8 | 8 | #[allow(clippy::too_many_arguments)]
|
9 | 9 | pub(super) fn compare_candidates<'a>(
|
@@ -52,8 +52,14 @@ pub(super) fn compare_candidates<'a>(
|
52 | 52 | // Otherwise, compare the dependencies of the variants. If there are similar
|
53 | 53 | // dependencies select the variant that selects the highest version of the dependency.
|
54 | 54 | let (a_dependencies, b_dependencies) = match (
|
55 |
| - solver.get_or_cache_dependencies(a).now_or_never().expect("get_or_cache_dependencies failed"), |
56 |
| - solver.get_or_cache_dependencies(b).now_or_never().expect("get_or_cache_dependencies failed"), |
| 55 | + solver |
| 56 | + .get_or_cache_dependencies(a) |
| 57 | + .now_or_never() |
| 58 | + .expect("get_or_cache_dependencies failed"), |
| 59 | + solver |
| 60 | + .get_or_cache_dependencies(b) |
| 61 | + .now_or_never() |
| 62 | + .expect("get_or_cache_dependencies failed"), |
57 | 63 | ) {
|
58 | 64 | (Ok(a_deps), Ok(b_deps)) => (a_deps, b_deps),
|
59 | 65 | // If either call fails, it's likely due to solver cancellation; thus, we can't compare dependencies
|
@@ -149,8 +155,10 @@ pub(super) fn find_highest_version<'a>(
|
149 | 155 | match_spec_highest_version
|
150 | 156 | .entry(match_spec_id)
|
151 | 157 | .or_insert_with(|| {
|
152 |
| - let candidates = |
153 |
| - solver.get_or_cache_matching_candidates(match_spec_id).now_or_never().expect("get_or_cache_matching_candidates failed"); |
| 158 | + let candidates = solver |
| 159 | + .get_or_cache_matching_candidates(match_spec_id) |
| 160 | + .now_or_never() |
| 161 | + .expect("get_or_cache_matching_candidates failed"); |
154 | 162 |
|
155 | 163 | // Err only happens on cancellation, so we will not continue anyways
|
156 | 164 | let candidates = if let Ok(candidates) = candidates {
|
|
0 commit comments