From 44e0b633d945804ad0e97ed01e42fdfe72347b06 Mon Sep 17 00:00:00 2001 From: Corwin Date: Mon, 31 Oct 2022 20:31:37 +0000 Subject: [PATCH] use copy implementation instead --- agb-fixnum/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/agb-fixnum/src/lib.rs b/agb-fixnum/src/lib.rs index ad122fea..2accff36 100644 --- a/agb-fixnum/src/lib.rs +++ b/agb-fixnum/src/lib.rs @@ -819,7 +819,7 @@ impl From> for Vector2 } } -#[derive(Debug, PartialEq, Eq, Clone)] +#[derive(Debug, PartialEq, Eq, Clone, Copy)] /// A rectangle with a position in 2d space and a 2d size pub struct Rect { /// The position of the rectangle @@ -875,7 +875,7 @@ impl Rect { /// let r2 = Rect::new(Vector2D::new(-10,-10), Vector2D::new(3,3)); /// assert!(!r.touches(r2)); /// ``` - pub fn touches(&self, other: &Rect) -> bool { + pub fn touches(&self, other: Rect) -> bool { self.position.x < other.position.x + other.size.x && self.position.x + self.size.x > other.position.x && self.position.y < other.position.y + other.size.y @@ -900,7 +900,7 @@ impl Rect { /// /// assert_eq!(r.overlapping_rect(r2), None); /// ``` - pub fn overlapping_rect(&self, other: &Rect) -> Option { + pub fn overlapping_rect(&self, other: Rect) -> Option { if !self.touches(other) { return None; }