From 2c19b5cdee20f8b5f54651b90174758df8ea5d3f Mon Sep 17 00:00:00 2001 From: Muhammad Nauman Raza Date: Tue, 28 May 2024 20:58:22 +0100 Subject: [PATCH] cargo: fmt --- src/app.rs | 4 ++-- src/handler.rs | 21 +++++++++++++-------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/app.rs b/src/app.rs index f61febc..4543cdc 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1,7 +1,7 @@ use std::error; -use tui_input::Input; use ratatui::widgets::ListState; +use tui_input::Input; use crate::api::SearchResult; @@ -73,7 +73,7 @@ impl Default for App { list: ResultList { state: ListState::default(), items: Vec::new(), - last_selected: None + last_selected: None, }, } } diff --git a/src/handler.rs b/src/handler.rs index 3a1faa9..ee59053 100644 --- a/src/handler.rs +++ b/src/handler.rs @@ -15,10 +15,15 @@ pub async fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult< } => { app.quit(); } - KeyEvent { code: KeyCode::Esc, .. } => { + KeyEvent { + code: KeyCode::Esc, .. + } => { app.quit(); } - KeyEvent { code: KeyCode::Enter, .. } => { + KeyEvent { + code: KeyCode::Enter, + .. + } => { app.list = ResultList { state: app.list.state.clone(), items: query_anime(app.input.to_string()).await.unwrap().results, @@ -32,11 +37,11 @@ pub async fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult< } } match key_event.code { - Char('j') | Down => app.list.next(), - Char('k') | Up => app.list.previous(), - Char('g') => app.go_top(), - Char('G') => app.go_bottom(), - _ => {} - } + Char('j') | Down => app.list.next(), + Char('k') | Up => app.list.previous(), + Char('g') => app.go_top(), + Char('G') => app.go_bottom(), + _ => {} + } Ok(()) }