From 5b72d3e6fedd74a62c25f275ffe1d23a21bbdc7e Mon Sep 17 00:00:00 2001 From: confusinguser <25439218+confusinguser@users.noreply.github.com> Date: Wed, 19 Jun 2024 20:32:58 +0200 Subject: [PATCH] Fix some weak warnings --- src/ai.rs | 4 ++-- src/cell.rs | 2 +- src/scene.rs | 2 +- src/units.rs | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ai.rs b/src/ai.rs index e1b2a1f..69766a6 100644 --- a/src/ai.rs +++ b/src/ai.rs @@ -1,7 +1,7 @@ +use crate::cell::*; use crate::gamemanager::*; use crate::movement::*; use crate::units::*; -use crate::{cell::*, movement}; #[derive(Default)] pub(crate) struct AICache { @@ -163,7 +163,7 @@ fn get_possible_moves(board: &Board, units: &Units, team: Team) -> Vec if unit.team != team { continue; } - for move_to in movement::get_unit_moves(unit, board, units) { + for move_to in get_unit_moves(unit, board, units) { output.push(GameMove { from: unit.coords, to: move_to, diff --git a/src/cell.rs b/src/cell.rs index f5a95a2..ce6117f 100644 --- a/src/cell.rs +++ b/src/cell.rs @@ -63,7 +63,7 @@ impl CellCoordinates { pub(crate) fn get_adjacent(&self, cube_side_length: u32) -> [CellCoordinates; 4] { let mut output: [CellCoordinates; 4] = Default::default(); let mut i = 0; - for direction in utils::CartesianDirection::directions() { + for direction in CartesianDirection::directions() { let adjacent = self.get_cell_in_direction(direction, cube_side_length); if adjacent.is_none() { diff --git a/src/scene.rs b/src/scene.rs index 4c4e9fc..8240ad8 100644 --- a/src/scene.rs +++ b/src/scene.rs @@ -44,7 +44,7 @@ pub(crate) fn construct_cube( } let plane_mesh: Handle = meshes.add(shape::Plane::default().into()); - let spacing = 1. / (side_length) as f32; + let spacing = 1. / side_length as f32; let offset = 0.5 - spacing / 2.; // The total side length of cube is always 1, so we offset // by 0.5 to get middle in origo. When cube at origo, half of its side is in negative diff --git a/src/units.rs b/src/units.rs index 20a115c..6b4c07c 100644 --- a/src/units.rs +++ b/src/units.rs @@ -124,6 +124,7 @@ impl Units { self.units.push(unit) } + //noinspection RsLiveness pub(crate) fn game_starting_configuration(cube_side_length: u32) -> Units { let mut output = Units::default(); macro_rules! unit_mirror {