remove RangeContains in favor of standard contains
authoralfadur
Wed, 22 May 2019 22:42:20 +0300
changeset 15046 dc4a12a84c92
parent 15045 af2f6f4074de
child 15047 a479916799ea
remove RangeContains in favor of standard contains
rust/integral-geometry/src/lib.rs
--- a/rust/integral-geometry/src/lib.rs	Tue May 21 23:04:50 2019 +0300
+++ b/rust/integral-geometry/src/lib.rs	Wed May 22 22:42:20 2019 +0300
@@ -1,7 +1,7 @@
 use fpnum::{distance, fp, FPNum, FPPoint};
 use std::{
     cmp::{max, min},
-    ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Range, RangeInclusive, Sub, SubAssign},
+    ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, RangeInclusive, Sub, SubAssign},
 };
 
 #[derive(PartialEq, Eq, Clone, Copy, Debug)]
@@ -416,7 +416,7 @@
 
     #[inline]
     pub fn contains(&self, point: Point) -> bool {
-        self.x_range().contains(point.x) && self.y_range().contains(point.y)
+        self.x_range().contains(&point.x) && self.y_range().contains(&point.y)
     }
 
     #[inline]
@@ -467,22 +467,6 @@
     }
 }
 
-trait RangeContains<T> {
-    fn contains(&self, value: T) -> bool;
-}
-
-impl<T: Ord> RangeContains<T> for Range<T> {
-    fn contains(&self, value: T) -> bool {
-        value >= self.start && value < self.end
-    }
-}
-
-impl<T: Ord> RangeContains<T> for RangeInclusive<T> {
-    fn contains(&self, value: T) -> bool {
-        value >= *self.start() && value <= *self.end()
-    }
-}
-
 trait RangeClamp<T> {
     fn clamp(&self, value: T) -> T;
 }