diff --git a/src/internal/incompatibility.rs b/src/internal/incompatibility.rs index da906c70..ce45852b 100644 --- a/src/internal/incompatibility.rs +++ b/src/internal/incompatibility.rs @@ -362,10 +362,12 @@ impl fmt::Display #[cfg(test)] pub mod tests { - use super::*; + use proptest::prelude::*; + use crate::range::Range; use crate::term::tests::strategy as term_strat; - use proptest::prelude::*; + + use super::*; proptest! { diff --git a/src/range.rs b/src/range.rs index 4b0663e6..77d96b75 100644 --- a/src/range.rs +++ b/src/range.rs @@ -217,7 +217,7 @@ impl Range { .segments .last() .expect("if there is a first element, there must be a last element"); - (bound_as_ref(start), bound_as_ref(&end.1)) + (start.as_ref(), end.1.as_ref()) }) } @@ -334,16 +334,6 @@ fn within_bounds(version: &V, segment: &Interval) -> Ordering Ordering::Greater } -/// Implementation of [`Bound::as_ref`] which is currently marked as unstable. -fn bound_as_ref(bound: &Bound) -> Bound<&V> { - match bound { - Included(v) => Included(v), - Excluded(v) => Excluded(v), - Unbounded => Unbounded, - } -} - -/// A valid segment is one where at least one version fits between start and end fn valid_segment(start: &Bound, end: &Bound) -> bool { match (start, end) { // Singleton interval are allowed @@ -737,7 +727,7 @@ impl Display for Range { } else { for (idx, segment) in self.segments.iter().enumerate() { if idx > 0 { - write!(f, ", ")?; + write!(f, " | ")?; } match segment { (Unbounded, Unbounded) => write!(f, "*")?, @@ -748,7 +738,7 @@ impl Display for Range { if v == b { write!(f, "=={v}")? } else { - write!(f, ">={v},<={b}")? + write!(f, ">={v}, <={b}")? } } (Included(v), Excluded(b)) => write!(f, ">={v}, <{b}")?, diff --git a/tests/examples.rs b/tests/examples.rs index 806a332d..db0d3258 100644 --- a/tests/examples.rs +++ b/tests/examples.rs @@ -231,8 +231,8 @@ fn confusing_with_lots_of_holes() { }; assert_eq!( &DefaultStringReporter::report(&derivation_tree), - r#"Because there is no available version for bar and foo ==1, ==2, ==3, ==4, ==5 depends on bar, foo ==1, ==2, ==3, ==4, ==5 is forbidden. -And because there is no version of foo in <1, >1, <2, >2, <3, >3, <4, >4, <5, >5 and root ==1 depends on foo, root ==1 is forbidden."# + r#"Because there is no available version for bar and foo ==1 | ==2 | ==3 | ==4 | ==5 depends on bar, foo ==1 | ==2 | ==3 | ==4 | ==5 is forbidden. +And because there is no version of foo in <1 | >1, <2 | >2, <3 | >3, <4 | >4, <5 | >5 and root ==1 depends on foo, root ==1 is forbidden."# ); derivation_tree.collapse_no_versions(); assert_eq!(