# HG changeset patch # User alfadur # Date 1558554140 -10800 # Node ID dc4a12a84c92fada31ccd2d1fdaabe9878ab4e8f # Parent af2f6f4074deca62ffd02bcfaff7f5f21f99366c remove RangeContains in favor of standard contains diff -r af2f6f4074de -r dc4a12a84c92 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 { - fn contains(&self, value: T) -> bool; -} - -impl RangeContains for Range { - fn contains(&self, value: T) -> bool { - value >= self.start && value < self.end - } -} - -impl RangeContains for RangeInclusive { - fn contains(&self, value: T) -> bool { - value >= *self.start() && value <= *self.end() - } -} - trait RangeClamp { fn clamp(&self, value: T) -> T; }