diff options
author | eug-vs <eugene@eug-vs.xyz> | 2024-01-25 11:24:36 +0100 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2024-01-25 11:24:36 +0100 |
commit | 746e3bf17463a377b6c54b291ebef9a736d6ceb7 (patch) | |
tree | a4e965669871084b98d3ce89ac95fa9d50131699 /src/square.rs | |
parent | 299c6d6dee96a50f9366955192f922d449d11f20 (diff) | |
download | chessnost-canary.tar.gz |
chore: autoformat codecanary
Use #[rustfmt:skip] to preserve aligned blocks
Diffstat (limited to 'src/square.rs')
-rw-r--r-- | src/square.rs | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/src/square.rs b/src/square.rs index c7f185e..f94f065 100644 --- a/src/square.rs +++ b/src/square.rs @@ -1,4 +1,4 @@ -use std::{str::Chars, fmt::Display}; +use std::{fmt::Display, str::Chars}; use crate::bitboard::Bitboard; @@ -6,6 +6,7 @@ use crate::bitboard::Bitboard; #[allow(dead_code)] #[derive(Debug, Clone, Copy, PartialEq, Eq, num_enum::FromPrimitive)] #[repr(u8)] +#[rustfmt::skip] pub enum Square { #[default] A1, B1, C1, D1, E1, F1, G1, H1, @@ -54,29 +55,25 @@ impl Square { pub fn from_notation(chars: &mut Chars) -> Result<Self, String> { let file = match chars.next() { - Some(ch) => { - match ch { - 'a' => 0, - 'b' => 1, - 'c' => 2, - 'd' => 3, - 'e' => 4, - 'f' => 5, - 'g' => 6, - 'h' => 7, - _ => return Err(String::from("Incorrect file!")) - } + Some(ch) => match ch { + 'a' => 0, + 'b' => 1, + 'c' => 2, + 'd' => 3, + 'e' => 4, + 'f' => 5, + 'g' => 6, + 'h' => 7, + _ => return Err(String::from("Incorrect file!")), }, - None => return Err(String::from("Missing file")) + None => return Err(String::from("Missing file")), }; let rank = match chars.next() { - Some(ch) => { - match ch.to_digit(10) { - Some(digit) => digit - 1, - None => return Err(String::from("Incorrect rank")) - } - } - None => return Err(String::from("Missing rank")) + Some(ch) => match ch.to_digit(10) { + Some(digit) => digit - 1, + None => return Err(String::from("Incorrect rank")), + }, + None => return Err(String::from("Missing rank")), }; Ok(Self::from_coords(rank as u8, file)) @@ -97,5 +94,3 @@ impl Display for Square { write!(f, "{}", notation) } } - - |