Format the code, apply clippy fixes transitional_engine
authorunC0Rr
Wed, 15 Feb 2023 12:42:43 +0100
branchtransitional_engine
changeset 15926 c273908218f3
parent 15925 b0e8cc72bfef
child 15928 772a43d88e6b
Format the code, apply clippy fixes
rust/landgen/src/outline_template_based/outline.rs
rust/landgen/src/wavefront_collapse/generator.rs
--- a/rust/landgen/src/outline_template_based/outline.rs	Wed Feb 15 12:36:24 2023 +0100
+++ b/rust/landgen/src/outline_template_based/outline.rs	Wed Feb 15 12:42:43 2023 +0100
@@ -180,16 +180,12 @@
 
         // now go through all other segments
         for s in self.segments_iter() {
-            if s != segment {
-                if intersects(&normal_ray, &s) {
-                    if let Some((t, d)) =
-                        solve_intersection(&self.intersections_box, &normal_ray, &s)
-                    {
-                        if t > 0 {
-                            dist_right = min(dist_right, d);
-                        } else {
-                            dist_left = min(dist_left, d);
-                        }
+            if s != segment && intersects(&normal_ray, &s) {
+                if let Some((t, d)) = solve_intersection(&self.intersections_box, &normal_ray, &s) {
+                    if t > 0 {
+                        dist_right = min(dist_right, d);
+                    } else {
+                        dist_left = min(dist_left, d);
                     }
                 }
             }
@@ -197,32 +193,33 @@
 
         // go through all points, including fill points
         for pi in self.iter().cloned() {
-            if pi != segment.start && pi != segment.end {
-                if intersects(&pi.ray_with_dir(normal), &segment) {
-                    // ray from segment.start
-                    if let Some((t, d)) = solve_intersection(
-                        &self.intersections_box,
-                        &normal_ray,
-                        &segment.start.line_to(pi),
-                    ) {
-                        if t > 0 {
-                            dist_right = min(dist_right, d);
-                        } else {
-                            dist_left = min(dist_left, d);
-                        }
+            if pi != segment.start
+                && pi != segment.end
+                && intersects(&pi.ray_with_dir(normal), &segment)
+            {
+                // ray from segment.start
+                if let Some((t, d)) = solve_intersection(
+                    &self.intersections_box,
+                    &normal_ray,
+                    &segment.start.line_to(pi),
+                ) {
+                    if t > 0 {
+                        dist_right = min(dist_right, d);
+                    } else {
+                        dist_left = min(dist_left, d);
                     }
+                }
 
-                    // ray from segment.end
-                    if let Some((t, d)) = solve_intersection(
-                        &self.intersections_box,
-                        &normal_ray,
-                        &segment.end.line_to(pi),
-                    ) {
-                        if t > 0 {
-                            dist_right = min(dist_right, d);
-                        } else {
-                            dist_left = min(dist_left, d);
-                        }
+                // ray from segment.end
+                if let Some((t, d)) = solve_intersection(
+                    &self.intersections_box,
+                    &normal_ray,
+                    &segment.end.line_to(pi),
+                ) {
+                    if t > 0 {
+                        dist_right = min(dist_right, d);
+                    } else {
+                        dist_left = min(dist_left, d);
                     }
                 }
             }
--- a/rust/landgen/src/wavefront_collapse/generator.rs	Wed Feb 15 12:36:24 2023 +0100
+++ b/rust/landgen/src/wavefront_collapse/generator.rs	Wed Feb 15 12:42:43 2023 +0100
@@ -123,13 +123,8 @@
             (&tile_description.edges.left).into(),
         ];
 
-        let tile = TileImage::<T, String>::new(
-            tiles_image,
-            top_edge,
-            right_edge,
-            bottom_edge,
-            left_edge,
-        );
+        let tile =
+            TileImage::<T, String>::new(tiles_image, top_edge, right_edge, bottom_edge, left_edge);
 
         result.push(tile.clone());