From 92a1214dcdbead48f520cb4f1d8e53f59b5619e1 Mon Sep 17 00:00:00 2001 From: Adhyan Date: Sun, 1 Sep 2024 19:05:23 -0600 Subject: [PATCH] passes clippy lints --- src/list.rs | 12 ++++++------ src/list/state.rs | 5 ++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/list.rs b/src/list.rs index 351b0b5..0f0643c 100644 --- a/src/list.rs +++ b/src/list.rs @@ -32,9 +32,9 @@ fn handle_list(app_state: &mut AppState, stdout: &mut StdoutLock) -> Result<()> } list_state.message.clear(); - + let curr_key = key.code; - + if is_searching { match curr_key { KeyCode::Esc | KeyCode::Enter => { @@ -46,10 +46,10 @@ fn handle_list(app_state: &mut AppState, stdout: &mut StdoutLock) -> Result<()> list_state.search_query.push(k); list_state.message.push_str("search:"); list_state.message.push_str(&list_state.search_query); - list_state.message.push_str("|"); - + list_state.message.push('|'); + list_state.select_if_matches_search_query(); - + list_state.draw(stdout)?; continue; } @@ -57,7 +57,7 @@ fn handle_list(app_state: &mut AppState, stdout: &mut StdoutLock) -> Result<()> list_state.search_query.pop(); list_state.message.push_str("search:"); list_state.message.push_str(&list_state.search_query); - list_state.message.push_str("|"); + list_state.message.push('|'); list_state.select_if_matches_search_query(); diff --git a/src/list/state.rs b/src/list/state.rs index 7dfd6b5..be05f3b 100644 --- a/src/list/state.rs +++ b/src/list/state.rs @@ -346,7 +346,7 @@ impl<'a> ListState<'a> { Ok(()) } - + pub fn select_if_matches_search_query(&mut self) { let idx = self .app_state @@ -360,7 +360,7 @@ impl<'a> ListState<'a> { None } }); - + match idx { Some(i) => { // ? do we need this function call? @@ -375,7 +375,6 @@ impl<'a> ListState<'a> { self.message.push_str(&msg); } } - } // Return `true` if there was something to select.