From bc24308fa12a2d522966f8d8f790fcefaab1454a Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Fri, 25 Mar 2022 01:00:30 -0500 Subject: [PATCH] Appease Clippy and fix gnarly visibility error. --- src/exploration.rs | 1 - src/lib.rs | 2 +- src/log.rs | 9 ++++++--- src/map.rs | 5 +---- src/navigation.rs | 5 +---- src/pathfinding.rs | 2 +- src/sound.rs | 2 +- src/visibility.rs | 5 ++--- 8 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/exploration.rs b/src/exploration.rs index de4038f..cd7b925 100644 --- a/src/exploration.rs +++ b/src/exploration.rs @@ -5,7 +5,6 @@ use bevy_input_actionmap::InputMap; use bevy_rapier2d::prelude::*; use bevy_tts::Tts; use derive_more::{Deref, DerefMut}; -use here_be_dragons::Tile; use crate::{ core::{Coordinates, Player, PointLike}, diff --git a/src/lib.rs b/src/lib.rs index ccfd1a6..eedc089 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(unused_imports)] +#![allow(clippy::needless_range_loop)] #![allow(clippy::too_many_arguments)] #![allow(clippy::type_complexity)] diff --git a/src/log.rs b/src/log.rs index db1cb33..f550b84 100644 --- a/src/log.rs +++ b/src/log.rs @@ -24,9 +24,12 @@ pub struct LogEntry { pub message: String, } -impl Into for LogEntry { - fn into(self) -> String { - self.message +impl From for LogEntry { + fn from(string: String) -> Self { + LogEntry { + time: Instant::now(), + message: string, + } } } diff --git a/src/map.rs b/src/map.rs index 263ff8c..aeaa0bb 100644 --- a/src/map.rs +++ b/src/map.rs @@ -1,7 +1,4 @@ -use std::{ - collections::{HashMap, HashSet}, - marker::PhantomData, -}; +use std::marker::PhantomData; use bevy::prelude::*; use bevy_rapier2d::prelude::*; diff --git a/src/navigation.rs b/src/navigation.rs index fc01536..1bd8aec 100644 --- a/src/navigation.rs +++ b/src/navigation.rs @@ -1,7 +1,4 @@ -use std::{ - collections::HashMap, error::Error, f32::consts::PI, fmt::Debug, hash::Hash, - marker::PhantomData, -}; +use std::{error::Error, f32::consts::PI, fmt::Debug, hash::Hash, marker::PhantomData}; use bevy::prelude::*; use bevy_input_actionmap::InputMap; diff --git a/src/pathfinding.rs b/src/pathfinding.rs index a37a037..634fb77 100644 --- a/src/pathfinding.rs +++ b/src/pathfinding.rs @@ -12,7 +12,7 @@ use bevy_rapier2d::{ }; use derive_more::{Deref, DerefMut}; use futures_lite::future; -use here_be_dragons::Tile; + use pathfinding::prelude::*; use crate::{ diff --git a/src/sound.rs b/src/sound.rs index 160a894..9d9f71b 100644 --- a/src/sound.rs +++ b/src/sound.rs @@ -9,7 +9,7 @@ use crate::{ commands::RunIfExistsExt, core::{Coordinates, CoreConfig, Player, PointLike}, exploration::ExplorationFocused, - visibility::{Viewshed, VisibleEntities}, + visibility::VisibleEntities, }; #[derive(Component, Clone, Debug, Reflect)] diff --git a/src/visibility.rs b/src/visibility.rs index e730b99..25e41be 100644 --- a/src/visibility.rs +++ b/src/visibility.rs @@ -8,7 +8,7 @@ use bevy::{ core::{FixedTimestep, FloatOrd}, prelude::*, }; -use bevy_rapier2d::{na, na::UnitComplex}; +use bevy_rapier2d::na; use coord_2d::{Coord, Size}; use derive_more::{Deref, DerefMut}; use shadowcast::{vision_distance, Context, InputGrid}; @@ -19,7 +19,6 @@ use crate::{ core::{Angle, Coordinates, Player, PointLike}, log::Log, map::{ITileType, Map, MapConfig}, - utils::target_and_other, }; #[derive(Component, Clone, Copy, Debug, Default, Reflect)] @@ -80,8 +79,8 @@ impl Viewshed { { for e in entities { new_visible_entities.insert(*e); - return *opacity; } + return *opacity; } let tile = map.at(coord.x as usize, coord.y as usize); if tile.blocks_visibility() {