chore: fix various clippy warnings, disable trivial warnings in some spot

This commit is contained in:
2025-07-28 17:25:18 -05:00
parent b45980c172
commit c9bcf32381
11 changed files with 50 additions and 36 deletions

View File

@@ -18,7 +18,7 @@ impl Direction {
}
}
pub fn to_ivec2(&self) -> IVec2 {
pub fn as_ivec2(&self) -> IVec2 {
(*self).into()
}
}

View File

@@ -28,7 +28,7 @@ pub struct Node {
/// Each field contains an optional edge leading in that direction.
/// This structure is used to represent the adjacency list for each node,
/// providing O(1) access to edges in any cardinal direction.
#[derive(Debug)]
#[derive(Debug, Default)]
pub struct Intersection {
/// Edge leading upward from this node, if it exists.
pub up: Option<Edge>,
@@ -40,17 +40,6 @@ pub struct Intersection {
pub right: Option<Edge>,
}
impl Default for Intersection {
fn default() -> Self {
Self {
up: None,
down: None,
left: None,
right: None,
}
}
}
impl Intersection {
/// Returns an iterator over all edges from this intersection.
///
@@ -253,6 +242,7 @@ pub enum Position {
},
}
#[allow(dead_code)]
impl Position {
/// Returns `true` if the position is exactly at a node.
pub fn is_at_node(&self) -> bool {
@@ -260,6 +250,7 @@ impl Position {
}
/// Returns the `NodeId` of the current or most recently departed node.
#[allow(clippy::wrong_self_convention)]
pub fn from_node_id(&self) -> NodeId {
match self {
Position::AtNode(id) => *id,
@@ -268,6 +259,7 @@ impl Position {
}
/// Returns the `NodeId` of the destination node, if currently on an edge.
#[allow(clippy::wrong_self_convention)]
pub fn to_node_id(&self) -> Option<NodeId> {
match self {
Position::AtNode(_) => None,

View File

@@ -29,12 +29,12 @@ impl Pacman {
Direction::Right => "pacman/right",
};
let moving_tiles = vec![
SpriteAtlas::get_tile(&atlas, &format!("{}_a.png", moving_prefix)).unwrap(),
SpriteAtlas::get_tile(&atlas, &format!("{}_b.png", moving_prefix)).unwrap(),
SpriteAtlas::get_tile(&atlas, "pacman/full.png").unwrap(),
SpriteAtlas::get_tile(atlas, &format!("{moving_prefix}_a.png")).unwrap(),
SpriteAtlas::get_tile(atlas, &format!("{moving_prefix}_b.png")).unwrap(),
SpriteAtlas::get_tile(atlas, "pacman/full.png").unwrap(),
];
let stopped_tiles = vec![SpriteAtlas::get_tile(&atlas, &format!("{}_b.png", moving_prefix)).unwrap()];
let stopped_tiles = vec![SpriteAtlas::get_tile(atlas, &format!("{moving_prefix}_b.png")).unwrap()];
textures.insert(direction, AnimatedTexture::new(moving_tiles, 0.08));
stopped_textures.insert(direction, AnimatedTexture::new(stopped_tiles, 0.1));