fix: clippy single_match in heph-tui + add clippy pre-commit hook
All checks were successful
Build / validate (push) Successful in 9m35s

CI on main failed on a clippy::single_match lint in the heph-tui sidebar
key handler. Rewrite as `if let`. Also add a `cargo clippy -D warnings`
prek hook mirroring cargo-fmt, so lints are caught locally before CI
(prek previously only ran cargo fmt).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erich Blume 2026-06-03 20:53:50 -07:00
commit 6ddc9b83bf
4 changed files with 19 additions and 4 deletions

View file

@ -186,10 +186,11 @@ fn handle_key<B: heph_tui::Backend>(app: &mut App<B>, key: KeyEvent) -> Option<A
KeyCode::Char('D') => 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

View file

@ -0,0 +1 @@
Add a `cargo clippy -D warnings` pre-commit hook so lints are caught locally before CI.

View file

@ -0,0 +1 @@
Fix `clippy::single_match` lint in heph-tui sidebar key handling (CI failure on main).

View file

@ -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"