fix: lint errors

This commit is contained in:
Kristofers Solo 2025-01-05 17:40:37 +02:00
parent ecd98ea1e2
commit 603d0646bf

View File

@ -75,24 +75,24 @@ enum KeyDirection {
impl KeyDirection { impl KeyDirection {
/// Converts key direction to exact logical direction based on hex orientation /// Converts key direction to exact logical direction based on hex orientation
fn exact_direction(&self, orientation: &HexOrientation) -> Option<LogicalDirection> { const fn exact_direction(&self, orientation: &HexOrientation) -> Option<LogicalDirection> {
match orientation { match orientation {
HexOrientation::Pointy => match self { HexOrientation::Pointy => match self {
KeyDirection::Up => Some(LogicalDirection::PointyNorth), Self::Up => Some(LogicalDirection::PointyNorth),
KeyDirection::Down => Some(LogicalDirection::PointySouth), Self::Down => Some(LogicalDirection::PointySouth),
KeyDirection::UpRight => Some(LogicalDirection::PointyNorthEast), Self::UpRight => Some(LogicalDirection::PointyNorthEast),
KeyDirection::UpLeft => Some(LogicalDirection::PointyNorthWest), Self::UpLeft => Some(LogicalDirection::PointyNorthWest),
KeyDirection::DownRight => Some(LogicalDirection::PointySouthEast), Self::DownRight => Some(LogicalDirection::PointySouthEast),
KeyDirection::DownLeft => Some(LogicalDirection::PointySouthWest), Self::DownLeft => Some(LogicalDirection::PointySouthWest),
_ => None, _ => None,
}, },
HexOrientation::Flat => match self { HexOrientation::Flat => match self {
KeyDirection::Right => Some(LogicalDirection::FlatEast), Self::Right => Some(LogicalDirection::FlatEast),
KeyDirection::Left => Some(LogicalDirection::FlatWest), Self::Left => Some(LogicalDirection::FlatWest),
KeyDirection::UpRight => Some(LogicalDirection::FlatNorthEast), Self::UpRight => Some(LogicalDirection::FlatNorthEast),
KeyDirection::UpLeft => Some(LogicalDirection::FlatNorthWest), Self::UpLeft => Some(LogicalDirection::FlatNorthWest),
KeyDirection::DownRight => Some(LogicalDirection::FlatSouthEast), Self::DownRight => Some(LogicalDirection::FlatSouthEast),
KeyDirection::DownLeft => Some(LogicalDirection::FlatSouthWest), Self::DownLeft => Some(LogicalDirection::FlatSouthWest),
_ => None, _ => None,
}, },
} }
@ -103,54 +103,54 @@ impl KeyDirection {
match orientation { match orientation {
HexOrientation::Pointy => match self { HexOrientation::Pointy => match self {
// Single key presses check multiple directions // Single key presses check multiple directions
KeyDirection::Up => vec![ Self::Up => vec![
LogicalDirection::PointyNorth, LogicalDirection::PointyNorth,
LogicalDirection::PointyNorthEast, LogicalDirection::PointyNorthEast,
LogicalDirection::PointyNorthWest, LogicalDirection::PointyNorthWest,
], ],
KeyDirection::Right => vec![ Self::Right => vec![
LogicalDirection::PointyNorthEast, LogicalDirection::PointyNorthEast,
LogicalDirection::PointySouthEast, LogicalDirection::PointySouthEast,
], ],
KeyDirection::Down => vec![ Self::Down => vec![
LogicalDirection::PointySouth, LogicalDirection::PointySouth,
LogicalDirection::PointySouthEast, LogicalDirection::PointySouthEast,
LogicalDirection::PointySouthWest, LogicalDirection::PointySouthWest,
], ],
KeyDirection::Left => vec![ Self::Left => vec![
LogicalDirection::PointyNorthWest, LogicalDirection::PointyNorthWest,
LogicalDirection::PointySouthWest, LogicalDirection::PointySouthWest,
], ],
// Diagonal combinations check specific directions // Diagonal combinations check specific directions
KeyDirection::UpRight => vec![LogicalDirection::PointyNorthEast], Self::UpRight => vec![LogicalDirection::PointyNorthEast],
KeyDirection::UpLeft => vec![LogicalDirection::PointyNorthWest], Self::UpLeft => vec![LogicalDirection::PointyNorthWest],
KeyDirection::DownRight => vec![LogicalDirection::PointySouthEast], Self::DownRight => vec![LogicalDirection::PointySouthEast],
KeyDirection::DownLeft => vec![LogicalDirection::PointySouthWest], Self::DownLeft => vec![LogicalDirection::PointySouthWest],
}, },
HexOrientation::Flat => match self { HexOrientation::Flat => match self {
KeyDirection::Up => vec![ Self::Up => vec![
LogicalDirection::FlatNorthEast, LogicalDirection::FlatNorthEast,
LogicalDirection::FlatNorthWest, LogicalDirection::FlatNorthWest,
], ],
KeyDirection::Right => vec![ Self::Right => vec![
LogicalDirection::FlatEast, LogicalDirection::FlatEast,
LogicalDirection::FlatNorthEast, LogicalDirection::FlatNorthEast,
LogicalDirection::FlatSouthEast, LogicalDirection::FlatSouthEast,
], ],
KeyDirection::Down => vec![ Self::Down => vec![
LogicalDirection::FlatSouthEast, LogicalDirection::FlatSouthEast,
LogicalDirection::FlatSouthWest, LogicalDirection::FlatSouthWest,
], ],
KeyDirection::Left => vec![ Self::Left => vec![
LogicalDirection::FlatWest, LogicalDirection::FlatWest,
LogicalDirection::FlatNorthWest, LogicalDirection::FlatNorthWest,
LogicalDirection::FlatSouthWest, LogicalDirection::FlatSouthWest,
], ],
// Diagonal combinations check specific directions // Diagonal combinations check specific directions
KeyDirection::UpRight => vec![LogicalDirection::FlatNorthEast], Self::UpRight => vec![LogicalDirection::FlatNorthEast],
KeyDirection::UpLeft => vec![LogicalDirection::FlatNorthWest], Self::UpLeft => vec![LogicalDirection::FlatNorthWest],
KeyDirection::DownRight => vec![LogicalDirection::FlatSouthEast], Self::DownRight => vec![LogicalDirection::FlatSouthEast],
KeyDirection::DownLeft => vec![LogicalDirection::FlatSouthWest], Self::DownLeft => vec![LogicalDirection::FlatSouthWest],
}, },
} }
} }