From 5d45a0f74b779acb8ae49b66e4e6edddf5cc4953 Mon Sep 17 00:00:00 2001 From: Sam & Claude Date: Wed, 27 May 2026 15:15:15 +0200 Subject: [PATCH] Fix clippy collapsible_match in colibri-tui session nav (Sam & Claude) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Tab / BackTab key arms wrapped their whole body in `if !app.sessions.is_empty()`. clippy (-D warnings) flagged both as collapsible_match; lift the guard onto the match arm. Empty `sessions` now falls through to the catch-all — same no-op as before, behavior unchanged. Gates on c2655d1 + this: build ok, cargo test --workspace 65 passed/0 failed, cargo clippy --workspace --all-targets -- -D warnings clean, cargo fmt --check clean. Co-Authored-By: Claude Opus 4.7 --- crates/colibri-glasspane-tui/src/main.rs | 52 +++++++++++------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/crates/colibri-glasspane-tui/src/main.rs b/crates/colibri-glasspane-tui/src/main.rs index c4cf589..27089ae 100644 --- a/crates/colibri-glasspane-tui/src/main.rs +++ b/crates/colibri-glasspane-tui/src/main.rs @@ -529,35 +529,31 @@ async fn run(socket_path: PathBuf) -> io::Result<()> { } } } - KeyCode::Tab | KeyCode::Char('\t') => { - if !app.sessions.is_empty() { - app.session_idx = (app.session_idx + 1) % app.sessions.len(); - app.session_filter = app.sessions.get(app.session_idx).cloned(); - app.table_state.select(Some(0)); - app.detail_pane = None; - app.set_status(format!( - "session {}/{}", - app.session_idx + 1, - app.sessions.len() - )); - } + KeyCode::Tab | KeyCode::Char('\t') if !app.sessions.is_empty() => { + app.session_idx = (app.session_idx + 1) % app.sessions.len(); + app.session_filter = app.sessions.get(app.session_idx).cloned(); + app.table_state.select(Some(0)); + app.detail_pane = None; + app.set_status(format!( + "session {}/{}", + app.session_idx + 1, + app.sessions.len() + )); } - KeyCode::BackTab => { - if !app.sessions.is_empty() { - app.session_idx = if app.session_idx == 0 { - app.sessions.len() - 1 - } else { - app.session_idx - 1 - }; - app.session_filter = app.sessions.get(app.session_idx).cloned(); - app.table_state.select(Some(0)); - app.detail_pane = None; - app.set_status(format!( - "session {}/{}", - app.session_idx + 1, - app.sessions.len() - )); - } + KeyCode::BackTab if !app.sessions.is_empty() => { + app.session_idx = if app.session_idx == 0 { + app.sessions.len() - 1 + } else { + app.session_idx - 1 + }; + app.session_filter = app.sessions.get(app.session_idx).cloned(); + app.table_state.select(Some(0)); + app.detail_pane = None; + app.set_status(format!( + "session {}/{}", + app.session_idx + 1, + app.sessions.len() + )); } KeyCode::Down | KeyCode::Char('j') => { let count = app.filtered_panes().len();