Fix clippy lints

- format strings
This commit is contained in:
tali 2023-03-04 22:04:01 -05:00
parent c3d144f730
commit 3e52b6fb71
5 changed files with 12 additions and 12 deletions

View File

@ -18,7 +18,7 @@ pub fn mystery_mdse(init_mat: &Mat) -> i32 {
// find garbage rows covered by some rows of "residue"
while let Some(res_ys) = residue(&mat) {
debug_assert!(res_ys.len() != 0, "{res_ys:?}");
debug_assert!(!res_ys.is_empty(), "{res_ys:?}");
let res = &mut mat[res_ys];
if let Some((_x0, _y0, area)) = flood_fill(res) {
@ -106,8 +106,6 @@ fn flood_fill(rows: &mut [u16]) -> Option<(i16, i16, u32)> {
None
}
let (x0, y0) = init(&rows)?;
fn flood(rows: &mut [u16], x: i16, y: i16) -> u32 {
if x < 0 || y < 0 || (y as usize) >= rows.len() {
return 0;
@ -129,6 +127,8 @@ fn flood_fill(rows: &mut [u16]) -> Option<(i16, i16, u32)> {
+ flood(rows, x, y + 1)
}
let (x0, y0) = init(rows)?;
Some((x0, y0, flood(rows, x0, y0)))
}

View File

@ -29,8 +29,8 @@ pub fn i_deps(matrix: &Mat) -> i32 {
} else {
depth[x as usize] = 0;
}
mask = mask >> 1;
test = test >> 1;
mask >>= 1;
test >>= 1;
}
}
count

View File

@ -4,8 +4,8 @@ fn main() {
let out_dir = std::env::var_os("OUT_DIR").unwrap();
let out_dir = Path::new(&out_dir);
let srs_in = "../assets/srs.json";
let srs_out = out_dir.join("srs.rs");
println!("cargo:rerun-if-changed={}", srs_in);
mino_code_gen::compile_ruleset(srs_in, srs_out).unwrap()
let srs_in_path = "../assets/srs.json";
let srs_out_path = out_dir.join("srs.rs");
println!("cargo:rerun-if-changed={srs_in_path}");
mino_code_gen::compile_ruleset(srs_in_path, srs_out_path).unwrap()
}

View File

@ -280,7 +280,7 @@ mod test {
let loc = Loc { x, y, r };
let mut piece = Piece { ty: Tri, loc };
let result = super::rotate(&mut piece, MAT, dir);
assert_eq!(result.is_some(), piece.loc != loc, "{:?},{:?}", piece, loc);
assert_eq!(result.is_some(), piece.loc != loc, "{piece:?},{loc:?}");
(piece.loc.x, piece.loc.y, piece.loc.r, result)
}

View File

@ -27,12 +27,12 @@ pub mod srs;
#[macro_export]
macro_rules! mat {
($($row:literal);* $(;)?) => {
({
{
const MAT: &$crate::matrix::Mat = $crate::matrix::Mat::new(
&$crate::matrix::__ascii::parse([$($row),*]),
);
MAT
})
}
}
}