From 3e52b6fb71bb6cbdcec697ea3f4d4c19d8522e59 Mon Sep 17 00:00:00 2001 From: tali Date: Sat, 4 Mar 2023 22:04:01 -0500 Subject: [PATCH] Fix clippy lints - format strings --- fish/src/eval/downstacking.rs | 6 +++--- fish/src/eval/mod.rs | 4 ++-- mino/build.rs | 8 ++++---- mino/src/input.rs | 2 +- mino/src/lib.rs | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/fish/src/eval/downstacking.rs b/fish/src/eval/downstacking.rs index a34ca34..1fa456a 100644 --- a/fish/src/eval/downstacking.rs +++ b/fish/src/eval/downstacking.rs @@ -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))) } diff --git a/fish/src/eval/mod.rs b/fish/src/eval/mod.rs index c47d55b..1bd0d71 100644 --- a/fish/src/eval/mod.rs +++ b/fish/src/eval/mod.rs @@ -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 diff --git a/mino/build.rs b/mino/build.rs index 2eedbc6..71b16d4 100644 --- a/mino/build.rs +++ b/mino/build.rs @@ -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() } diff --git a/mino/src/input.rs b/mino/src/input.rs index 94551e6..19a7763 100644 --- a/mino/src/input.rs +++ b/mino/src/input.rs @@ -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) } diff --git a/mino/src/lib.rs b/mino/src/lib.rs index 1154060..3eac33b 100644 --- a/mino/src/lib.rs +++ b/mino/src/lib.rs @@ -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 - }) + } } }