diff --git a/crates/heph-tui/src/main.rs b/crates/heph-tui/src/main.rs index 6d8b85a..3f2d834 100644 --- a/crates/heph-tui/src/main.rs +++ b/crates/heph-tui/src/main.rs @@ -186,10 +186,11 @@ fn handle_key(app: &mut App, key: KeyEvent) -> Option app.begin_delete(), _ => {} }, - Focus::Sidebar => match key.code { - KeyCode::Char('D') => app.begin_delete_project(), - _ => {} - }, + Focus::Sidebar => { + if let KeyCode::Char('D') = key.code { + app.begin_delete_project() + } + } }, } None diff --git a/docs/changelog.d/+clippy-prek-hook.infra.md b/docs/changelog.d/+clippy-prek-hook.infra.md new file mode 100644 index 0000000..a3ed71b --- /dev/null +++ b/docs/changelog.d/+clippy-prek-hook.infra.md @@ -0,0 +1 @@ +Add a `cargo clippy -D warnings` pre-commit hook so lints are caught locally before CI. diff --git a/docs/changelog.d/+fix-clippy-single-match.bugfix.md b/docs/changelog.d/+fix-clippy-single-match.bugfix.md new file mode 100644 index 0000000..0548d68 --- /dev/null +++ b/docs/changelog.d/+fix-clippy-single-match.bugfix.md @@ -0,0 +1 @@ +Fix `clippy::single_match` lint in heph-tui sidebar key handling (CI failure on main). diff --git a/prek.toml b/prek.toml index c6a3a8f..ebd8d1a 100644 --- a/prek.toml +++ b/prek.toml @@ -97,6 +97,18 @@ language = "system" files = '\.rs$' pass_filenames = false +# Rust linting - cargo clippy over the whole workspace, denying warnings to +# match CI (`dagger call check` / .forgejo/scripts/build run the same command). +# Catches lints (e.g. clippy::single_match) before they reach CI. Uses the +# system toolchain; runs whenever a .rs file is staged. +[[repos.hooks]] +id = "cargo-clippy" +name = "cargo-clippy" +entry = "cargo clippy --all-targets --all-features -- -D warnings" +language = "system" +files = '\.rs$' +pass_filenames = false + # GitHub/Forgejo Actions workflow linting [[repos]] repo = "https://github.com/rhysd/actionlint"