mirror of
https://github.com/Xevion/Pac-Man.git
synced 2025-12-16 10:12:37 -06:00
chore: fix various clippy warnings, disable trivial warnings in some spot
This commit is contained in:
@@ -18,7 +18,7 @@ impl Direction {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_ivec2(&self) -> IVec2 {
|
||||
pub fn as_ivec2(&self) -> IVec2 {
|
||||
(*self).into()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user