File tree 1 file changed +11
-6
lines changed
1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -168,12 +168,6 @@ impl<V: Ord> Range<V> {
168
168
169
169
/// Returns true if the this Range contains the specified value.
170
170
pub fn contains ( & self , v : & V ) -> bool {
171
- if let Some ( bounding_range) = self . bounding_range ( ) {
172
- if !bounding_range. contains ( v) {
173
- return false ;
174
- }
175
- }
176
-
177
171
for segment in self . segments . iter ( ) {
178
172
if match segment {
179
173
( Unbounded , Unbounded ) => true ,
@@ -230,6 +224,13 @@ fn bound_as_ref<V>(bound: &Bound<V>) -> Bound<&V> {
230
224
}
231
225
232
226
impl < V : Ord + Clone > Range < V > {
227
+ /// Computes the union of this `Range` and another.
228
+ pub fn union ( & self , other : & Self ) -> Self {
229
+ self . complement ( )
230
+ . intersection ( & other. complement ( ) )
231
+ . complement ( )
232
+ }
233
+
233
234
/// Computes the intersection of two sets of versions.
234
235
pub fn intersection ( & self , other : & Self ) -> Self {
235
236
let mut segments: SmallVec < Interval < V > > = SmallVec :: empty ( ) ;
@@ -387,6 +388,10 @@ impl<T: Debug + Display + Clone + Eq + Ord> VersionSet for Range<T> {
387
388
fn full ( ) -> Self {
388
389
Range :: full ( )
389
390
}
391
+
392
+ fn union ( & self , other : & Self ) -> Self {
393
+ Range :: union ( self , other)
394
+ }
390
395
}
391
396
392
397
// REPORT ######################################################################
You can’t perform that action at this time.
0 commit comments