From 2474c9e68277850a76fa3019d5cf526e72376bd5 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 25 Mar 2021 01:13:09 +0000 Subject: [PATCH] geometry: Relax Ord to PartialOrd Signed-off-by: Ian Jackson --- base/geometry.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/base/geometry.rs b/base/geometry.rs index 4a4e2dd4..2e1708ce 100644 --- a/base/geometry.rs +++ b/base/geometry.rs @@ -198,14 +198,14 @@ impl PosC { // ---------- Area ---------- impl AreaC { - pub fn contains(&self, p: PosC) -> bool where T: Ord { + pub fn contains(&self, p: PosC) -> bool where T: PartialOrd { (0..2).all(|i| { p.0[i] >= self.0[0].0[i] && p.0[i] <= self.0[1].0[i] }) } - pub fn overlaps(&self, other: &AreaC) -> bool where T: Ord { + pub fn overlaps(&self, other: &AreaC) -> bool where T: PartialOrd { ! (0..2).any(|i| ( other.0[1].0[i] < self .0[0].0[i] || self .0[1].0[i] < other.0[0].0[i] @@ -245,7 +245,7 @@ pub enum Region { } impl Region { - pub fn contains(&self, pos: PosC) -> bool where T: Ord { + pub fn contains(&self, pos: PosC) -> bool where T: PartialOrd { use Region::*; match &self { Rectangle(a) => a.contains(pos), -- 2.30.2