From 0360cabf04cb2d357de3b18976861c9cc636c4db Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Thu, 5 Mar 2026 16:27:49 +0000 Subject: [PATCH] clippy: fix semicolon_if_nothing_returned lint https://rust-lang.github.io/rust-clippy/master/#semicolon_if_nothing_returned --- .git-hooks/pre-commit | 4 ++-- .github/workflows/lint.yaml | 4 ++-- benches/arenas_alloc.rs | 8 ++++---- benches/directory_item_build.rs | 2 +- benches/directory_item_build_x2.rs | 2 +- src/cli/tui.rs | 24 ++++++++++++------------ src/cli/view_state.rs | 2 +- src/lib.rs | 1 + src/rapid_arena.rs | 2 +- src/rapid_arena_test.rs | 4 ++-- src/space_bench.rs | 2 +- 11 files changed, 28 insertions(+), 27 deletions(-) diff --git a/.git-hooks/pre-commit b/.git-hooks/pre-commit index 3b63707..6df340c 100755 --- a/.git-hooks/pre-commit +++ b/.git-hooks/pre-commit @@ -59,7 +59,7 @@ else fi echo "👷 Checking CLI code with Clippy ..." -cargo clippy --all-features +cargo clippy --all-features -- --deny warnings CLIPPY_EXIT_CODE=$? if [ $CLIPPY_EXIT_CODE -ne 0 ]; then echo "❌ Please fix the issues Clippy raised in CLI code." @@ -79,7 +79,7 @@ else fi echo "👷 Checking BuildIt code with Clippy ..." -cargo clippy --manifest-path ./buildit/Cargo.toml --all-features +cargo clippy --manifest-path ./buildit/Cargo.toml --all-features -- --deny warnings CLIPPY_EXIT_CODE=$? if [ $CLIPPY_EXIT_CODE -ne 0 ]; then echo "❌ Please fix the issues Clippy raised in BuildIt code." diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 1272f3f..c94c611 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -29,10 +29,10 @@ jobs: run: cargo fmt --manifest-path ./buildit/Cargo.toml -- --check - name: Lint with Clippy - run: cargo clippy --no-deps --all-features + run: cargo clippy --no-deps --all-features -- --deny warnings - name: Check code formatting (BuildIt) run: cargo fmt -- --check - name: Lint with Clippy (BuildIt) - run: cargo clippy --manifest-path ./buildit/Cargo.toml --all-features + run: cargo clippy --manifest-path ./buildit/Cargo.toml --all-features -- --deny warnings diff --git a/benches/arenas_alloc.rs b/benches/arenas_alloc.rs index 3dd8c7f..2090082 100644 --- a/benches/arenas_alloc.rs +++ b/benches/arenas_alloc.rs @@ -97,7 +97,7 @@ fn benchmark_std_alloc( }); items.push(parent); - }) + }); }); if sample_number == sample_size { @@ -150,7 +150,7 @@ fn benchmark_bumpalo( parent.children.push(child); item_count += 1; - }) + }); }); if sample_number == sample_size { @@ -203,7 +203,7 @@ fn benchmark_id_arena( }); arena.get_mut(parent).unwrap().children.push(child); - }) + }); }); if sample_number == sample_size { @@ -266,7 +266,7 @@ fn benchmark_rapid_arena( }); parent.deref_mut().children.push(child); - }) + }); }); if sample_number == sample_size { diff --git a/benches/directory_item_build.rs b/benches/directory_item_build.rs index 839069a..5ef99ec 100644 --- a/benches/directory_item_build.rs +++ b/benches/directory_item_build.rs @@ -16,7 +16,7 @@ pub fn directory_item_build(c: &mut Criterion) { |b| { b.iter(|| { black_box(DirectoryItem::build(vec![path.clone()], &should_exit)); - }) + }); }, ); } diff --git a/benches/directory_item_build_x2.rs b/benches/directory_item_build_x2.rs index 14864cf..e766848 100644 --- a/benches/directory_item_build_x2.rs +++ b/benches/directory_item_build_x2.rs @@ -26,7 +26,7 @@ pub fn directory_item_build_x2(c: &mut Criterion) { |b| { b.iter(|| { black_box(DirectoryItem::build(vec![path.clone()], &should_exit)); - }) + }); }, ); } diff --git a/src/cli/tui.rs b/src/cli/tui.rs index 1a42087..8e6bcb0 100644 --- a/src/cli/tui.rs +++ b/src/cli/tui.rs @@ -172,34 +172,34 @@ fn render_loop( } else { match code { KeyCode::Char(VIEW_SIZE_THRESHOLD_0_PERCENT_KEY) => { - view_state.set_size_threshold_fraction(0f32) + view_state.set_size_threshold_fraction(0f32); } KeyCode::Char(VIEW_SIZE_THRESHOLD_10_PERCENT_KEY) => { - view_state.set_size_threshold_fraction(0.01f32) + view_state.set_size_threshold_fraction(0.01f32); } KeyCode::Char(VIEW_SIZE_THRESHOLD_20_PERCENT_KEY) => { - view_state.set_size_threshold_fraction(0.02f32) + view_state.set_size_threshold_fraction(0.02f32); } KeyCode::Char(VIEW_SIZE_THRESHOLD_30_PERCENT_KEY) => { - view_state.set_size_threshold_fraction(0.03f32) + view_state.set_size_threshold_fraction(0.03f32); } KeyCode::Char(VIEW_SIZE_THRESHOLD_40_PERCENT_KEY) => { - view_state.set_size_threshold_fraction(0.04f32) + view_state.set_size_threshold_fraction(0.04f32); } KeyCode::Char(VIEW_SIZE_THRESHOLD_50_PERCENT_KEY) => { - view_state.set_size_threshold_fraction(0.05f32) + view_state.set_size_threshold_fraction(0.05f32); } KeyCode::Char(VIEW_SIZE_THRESHOLD_60_PERCENT_KEY) => { - view_state.set_size_threshold_fraction(0.06f32) + view_state.set_size_threshold_fraction(0.06f32); } KeyCode::Char(VIEW_SIZE_THRESHOLD_70_PERCENT_KEY) => { - view_state.set_size_threshold_fraction(0.07f32) + view_state.set_size_threshold_fraction(0.07f32); } KeyCode::Char(VIEW_SIZE_THRESHOLD_80_PERCENT_KEY) => { - view_state.set_size_threshold_fraction(0.08f32) + view_state.set_size_threshold_fraction(0.08f32); } KeyCode::Char(VIEW_SIZE_THRESHOLD_90_PERCENT_KEY) => { - view_state.set_size_threshold_fraction(0.09f32) + view_state.set_size_threshold_fraction(0.09f32); } KeyCode::Char(HELP_KEY) => view_state.show_help = true, KeyCode::Char(DELETE_KEY) => view_state.show_delete_dialog = true, @@ -214,11 +214,11 @@ fn render_loop( KeyCode::End => view_state.last(), KeyCode::Char(COLLAPSE_SELECTED_CHILDREN_KEY) | KeyCode::Char(COLLAPSE_SELECTED_CHILDREN_KEY_ALT) => { - view_state.collapse_selected_children() + view_state.collapse_selected_children(); } KeyCode::Char(EXPAND_SELECTED_CHILDREN_KEY) | KeyCode::Char(EXPAND_SELECTED_CHILDREN_KEY_ALT) => { - view_state.expand_selected_children() + view_state.expand_selected_children(); } _ => {} } diff --git a/src/cli/view_state.rs b/src/cli/view_state.rs index f83939f..98ff5ff 100644 --- a/src/cli/view_state.rs +++ b/src/cli/view_state.rs @@ -377,7 +377,7 @@ impl ViewState { for item in &self.item_tree { count += get_item_tree_count(item); } - self.total_items_in_tree = count + self.total_items_in_tree = count; } pub(crate) fn accept_license_terms(&mut self) { diff --git a/src/lib.rs b/src/lib.rs index 24e43d0..e54463d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,7 @@ #![deny(missing_debug_implementations)] #![deny(missing_docs)] #![deny(unreachable_pub)] +#![warn(clippy::semicolon_if_nothing_returned)] //! Space may be the final frontier, but it sure is annoying when you run out. 🖖 //! diff --git a/src/rapid_arena.rs b/src/rapid_arena.rs index 78110dd..72422ae 100644 --- a/src/rapid_arena.rs +++ b/src/rapid_arena.rs @@ -103,7 +103,7 @@ impl RapIdArena { for item in bucket { data.push(RapId { p: ptr::NonNull::from(item), - }) + }); } } RapIdArenaIterator:: { data, index: 0 } diff --git a/src/rapid_arena_test.rs b/src/rapid_arena_test.rs index fc3cbc8..0f071e0 100644 --- a/src/rapid_arena_test.rs +++ b/src/rapid_arena_test.rs @@ -261,7 +261,7 @@ fn deref_multi_threaded_test() { #[allow(clippy::unit_arg)] black_box({ let _ = item.some_value + 1; - }) + }); } }); } @@ -296,7 +296,7 @@ fn deref_mut_multi_threaded_test() { thread::sleep(Duration::from_millis(1)); assert_eq!(some_value, item.some_value); - assert_eq!(some_string, item.some_string) + assert_eq!(some_string, item.some_string); } }); } diff --git a/src/space_bench.rs b/src/space_bench.rs index 36739bb..638f548 100644 --- a/src/space_bench.rs +++ b/src/space_bench.rs @@ -133,7 +133,7 @@ impl BenchmarkCommand { .unwrap() .run(self) .unwrap(); - }) + }); }); Ok(()) }