clippy
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
use crate::floor::Floor;
|
||||
use crate::fov::{color_to_rgb, FovCaster, Lighting};
|
||||
use crate::glyph::Glyph;
|
||||
use crate::log::LogLine;
|
||||
use crate::utils::{Direction, Point};
|
||||
use crate::utils::{ObjectId, RegistryValue};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
@@ -147,9 +146,7 @@ impl Board {
|
||||
}
|
||||
|
||||
// Otherwise the floor, or the canonical black empty cell.
|
||||
self.floor
|
||||
.glyph_at(p, self.width)
|
||||
.unwrap_or_else(|| Glyph::transparent())
|
||||
self.floor.glyph_at(p, self.width).unwrap_or_else(Glyph::transparent)
|
||||
}
|
||||
|
||||
/// Returns `true` if `(x, y)` is a valid cell coordinate on this board.
|
||||
@@ -306,7 +303,7 @@ impl Board {
|
||||
// Find which ones are blockers
|
||||
let mut immobile = HashSet::new();
|
||||
for (curr_idx, curr) in solids.iter().enumerate() {
|
||||
let pushable = curr.as_ref().map_or(true, |c| c.shiftable());
|
||||
let pushable = curr.as_ref().is_none_or(Tile::shiftable);
|
||||
if !pushable {
|
||||
immobile.insert(curr_idx);
|
||||
}
|
||||
@@ -438,7 +435,7 @@ impl Board {
|
||||
}
|
||||
|
||||
// Sort by id
|
||||
hookables.sort_by(|a, b| a.id().cmp(&b.id()));
|
||||
hookables.sort_by_key(|a| a.id());
|
||||
hookables
|
||||
}
|
||||
|
||||
@@ -455,7 +452,7 @@ impl Board {
|
||||
}
|
||||
|
||||
pub fn move_sensor(&mut self, id: ObjectId, dir: Direction) {
|
||||
if let Some((sensor_idx, _)) = self.sensors.iter().enumerate().find(|(idx, s)| s.scripting.id == id) {
|
||||
if let Some(sensor_idx) = self.sensors.iter().position(|s| s.scripting.id == id) {
|
||||
let new_loc = self.sensors[sensor_idx].location.in_dir(dir);
|
||||
if self.in_bounds(new_loc) {
|
||||
self.sensors[sensor_idx].location = new_loc
|
||||
|
||||
Reference in New Issue
Block a user