Fixed a bunch of clippy suggestions
[kaka/rust-sdl-test.git] / src / common / geometry.rs
index 50d1994..540db53 100644 (file)
@@ -278,7 +278,7 @@ impl Intersection {
            let s = (-s1.y * (p1.x - p3.x) + s1.x * (p1.y - p3.y)) / denomimator;
            let t = ( s2.x * (p1.y - p3.y) - s2.y * (p1.x - p3.x)) / denomimator;
 
-           if s >= 0.0 && s <= 1.0 && t >= 0.0 && t <= 1.0 {
+           if (0.0..=1.0).contains(&s) && (0.0..=1.0).contains(&t) {
                return Intersection::Point(p1 + (s1 * t))
            }
        }
@@ -335,7 +335,7 @@ pub fn supercover_line_int(p1: Point<isize>, p2: Point<isize>) -> Vec<Point<isiz
        if d.y > 0 { 1 } else { -1 }
     );
 
-    let mut p = p1.clone();
+    let mut p = p1;
     let mut points = vec!(point!(p.x as isize, p.y as isize));
     let mut i = point!(0, 0);
     while i.x < n.x || i.y < n.y {