diff --git a/crates/uv-resolver/src/requires_python.rs b/crates/uv-resolver/src/requires_python.rs index 2656b331e..68e3cdd14 100644 --- a/crates/uv-resolver/src/requires_python.rs +++ b/crates/uv-resolver/src/requires_python.rs @@ -414,29 +414,10 @@ impl Default for RequiresPythonRange { impl From for Range { fn from(value: RequiresPythonRange) -> Self { - match (value.0.as_ref(), value.1.as_ref()) { - (Bound::Included(lower), Bound::Included(upper)) => { - Range::from_range_bounds(lower.clone()..=upper.clone()) - } - (Bound::Included(lower), Bound::Excluded(upper)) => { - Range::from_range_bounds(lower.clone()..upper.clone()) - } - (Bound::Excluded(lower), Bound::Included(upper)) => { - Range::strictly_higher_than(lower.clone()) - .intersection(&Range::lower_than(upper.clone())) - } - (Bound::Excluded(lower), Bound::Excluded(upper)) => { - Range::strictly_higher_than(lower.clone()) - .intersection(&Range::strictly_lower_than(upper.clone())) - } - (Bound::Unbounded, Bound::Unbounded) => Range::full(), - (Bound::Unbounded, Bound::Included(upper)) => Range::lower_than(upper.clone()), - (Bound::Unbounded, Bound::Excluded(upper)) => Range::strictly_lower_than(upper.clone()), - (Bound::Included(lower), Bound::Unbounded) => Range::higher_than(lower.clone()), - (Bound::Excluded(lower), Bound::Unbounded) => { - Range::strictly_higher_than(lower.clone()) - } - } + Range::from_range_bounds::<(Bound, Bound), _>(( + value.0.into(), + value.1.into(), + )) } } @@ -470,6 +451,12 @@ impl Deref for RequiresPythonBound { } } +impl From for Bound { + fn from(bound: RequiresPythonBound) -> Self { + bound.0 + } +} + impl PartialOrd for RequiresPythonBound { fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other))