From 765f8ca08ef78d7df208bcdb3abb01e14f4c06fe Mon Sep 17 00:00:00 2001 From: Sibo Wang-Chen Date: Sat, 25 Jul 2026 22:38:34 +0200 Subject: [PATCH] Add cargo fmt check to CI, rename python-lint job to lint Folds the Rust formatting check into the existing linting job rather than a separate one, and renames it since it's no longer Python-only. Also applies cargo fmt to two files that had pre-existing drift, so the new check starts green. Co-Authored-By: Claude Sonnet 5 --- .github/workflows/ci.yml | 6 +++++- benchmark/quickik_rust/src/perf.rs | 16 +++++++++++----- tests/observation_test.rs | 6 ++++-- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e4a0c31..9003990 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,10 +52,14 @@ jobs: - run: cd python && maturin develop --release - run: pytest python/tests/ - python-lint: + lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 + - uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + - run: cargo fmt --all -- --check - uses: astral-sh/setup-uv@v7 - run: cd devtools-pyenv && uv sync # ruff.toml at the root covers python/tests/, benchmark/, and diff --git a/benchmark/quickik_rust/src/perf.rs b/benchmark/quickik_rust/src/perf.rs index 6f5dfa8..8e9f4d7 100644 --- a/benchmark/quickik_rust/src/perf.rs +++ b/benchmark/quickik_rust/src/perf.rs @@ -185,7 +185,12 @@ pub fn run_all(tree: &Arc, fixtures: &Fixtures, body: &str) { println!("-- single-frame time (latency), default config (adaptive early stop) --"); let single_frame_latency = summarize( "solve()", - bench_single_frame_latency(tree, &target_obs, 10_000, SolverConfig::::default()), + bench_single_frame_latency( + tree, + &target_obs, + 10_000, + SolverConfig::::default(), + ), ); // Early stop disabled (tolerances = 0), so every call runs the full @@ -289,7 +294,10 @@ fn tiled_native_rate_sequence_2d( /// `../plot/results/quickik-rust-2d-xyview-.json` for /// `../plot/plot_2d_comparison.py` to pick up. pub fn run_all_2d(tree: &Arc, fixtures: &Fixtures, body: &str) { - println!("quickik Rust benchmark, 2D via XYView (state_dim={})\n", tree.state_dim()); + println!( + "quickik Rust benchmark, 2D via XYView (state_dim={})\n", + tree.state_dim() + ); let target_obs = observations_2d_xyview(&fixtures.synthetic_frames[0].target_ego); println!("-- single-frame time (latency), default config (adaptive early stop) --"); @@ -323,9 +331,7 @@ pub fn run_all_2d(tree: &Arc, fixtures: &Fixtures, body: &str) { bench_single_frame_latency(tree, &target_obs, 10_000, max_iterations_config), ); - println!( - "\n-- single-thread sequence throughput (native-rate frames, adaptive early stop) --" - ); + println!("\n-- single-thread sequence throughput (native-rate frames, adaptive early stop) --"); let single_thread_sequence = tiled_native_rate_sequence_2d( &fixtures.native_rate_frames, SINGLE_THREAD_N_FRAMES, diff --git a/tests/observation_test.rs b/tests/observation_test.rs index 3e1b738..6326588 100644 --- a/tests/observation_test.rs +++ b/tests/observation_test.rs @@ -6,7 +6,8 @@ fn xyview_drops_z_and_passes_through_xy() { let mapper = XYView; let jacobian_world3d = DMatrix::from_row_slice(3, 2, &[1.0, 0.0, 0.0, 1.0, 0.0, 0.0]); let mut jac2d = DMatrix::::zeros(2, 2); - let pos2d = mapper.project_3d_to_2d(&Vector3::new(1.0, 2.0, 3.0), &jacobian_world3d, &mut jac2d); + let pos2d = + mapper.project_3d_to_2d(&Vector3::new(1.0, 2.0, 3.0), &jacobian_world3d, &mut jac2d); assert_eq!(pos2d, Vector2::new(1.0, 2.0)); assert_eq!(jac2d, jacobian_world3d.rows(0, 2).into_owned()); @@ -24,7 +25,8 @@ fn camera_projects_point_directly_in_front_to_principal_point() { }; let jacobian_world3d = DMatrix::::identity(3, 3); let mut jac2d = DMatrix::::zeros(2, 3); - let pos2d = camera.project_3d_to_2d(&Vector3::new(0.0, 0.0, 0.0), &jacobian_world3d, &mut jac2d); + let pos2d = + camera.project_3d_to_2d(&Vector3::new(0.0, 0.0, 0.0), &jacobian_world3d, &mut jac2d); assert!((pos2d - Vector2::new(320.0, 240.0)).norm() < 1e-4); }