Skip to content

Commit

Permalink
Filter to valid segments
Browse files Browse the repository at this point in the history
  • Loading branch information
konstin committed Nov 5, 2024
1 parent 3785196 commit 0e1502b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion version-ranges/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,10 @@ impl<V: Ord + Clone> Ranges<V> {
// 1. The segments are sorted, from lowest to highest (through `Ord`): By sorting.
// 2. Each segment contains at least one version (start < end): By `union`.
// 3. There is at least one version between two segments: By `union`.
let mut segments: SmallVec<_> = segments.into_iter().collect();
let mut segments: SmallVec<_> = segments
.into_iter()
.filter(|segment| valid_segment(&segment.start_bound(), &segment.end_bound()))
.collect();
segments.sort_by(|a: &Interval<V>, b: &Interval<V>| {
if a.start_bound() == b.start_bound() {
// The ends don't matter, we merge them anyway.
Expand Down

0 comments on commit 0e1502b

Please sign in to comment.