@@ -122,39 +122,33 @@ pub async fn run_tui(man_db: ManDb) -> Result<()> {
122122 terminal. draw ( |f| render_ui ( f, & mut app) ) ?;
123123
124124 if event:: poll ( Duration :: from_millis ( 16 ) ) ? {
125- match event:: read ( ) ? {
126- Event :: Key ( key) => {
127- if key. kind != KeyEventKind :: Press {
128- continue ;
129- }
125+ if let Event :: Key ( key) = event:: read ( ) ? {
126+ if key. kind != KeyEventKind :: Press {
127+ continue ;
128+ }
130129
131- // Handle Ctrl combinations first
132- match key {
133- KeyEvent {
134- code : KeyCode :: Char ( 'c' ) ,
135- modifiers : KeyModifiers :: CONTROL ,
136- ..
137- } => break ,
138- _ => { }
130+ // Handle Ctrl combinations first
131+ if let KeyEvent {
132+ code : KeyCode :: Char ( 'c' ) ,
133+ modifiers : KeyModifiers :: CONTROL ,
134+ ..
135+ } = key { break }
136+
137+ match key. code {
138+ KeyCode :: Char ( 'q' ) => break ,
139+ KeyCode :: Tab => toggle_focus ( & mut app) ,
140+ KeyCode :: Esc => app. focus = Focus :: CommandList ,
141+ KeyCode :: Char ( '/' ) if matches ! ( app. focus, Focus :: ManPage ) => {
142+ app. focus = Focus :: Search ;
143+ app. search . query . clear ( ) ;
139144 }
140-
141- match key. code {
142- KeyCode :: Char ( 'q' ) => break ,
143- KeyCode :: Tab => toggle_focus ( & mut app) ,
144- KeyCode :: Esc => app. focus = Focus :: CommandList ,
145- KeyCode :: Char ( '/' ) if matches ! ( app. focus, Focus :: ManPage ) => {
146- app. focus = Focus :: Search ;
147- app. search . query . clear ( ) ;
148- }
149- KeyCode :: Char ( 't' ) if matches ! ( app. focus, Focus :: ManPage ) => {
150- toggle_page_source ( & mut app) ;
151- app. pending_man_load = true ;
152- app. last_input_time = Instant :: now ( ) ;
153- }
154- _ => handle_key ( & mut app, key) . await ,
145+ KeyCode :: Char ( 't' ) if matches ! ( app. focus, Focus :: ManPage ) => {
146+ toggle_page_source ( & mut app) ;
147+ app. pending_man_load = true ;
148+ app. last_input_time = Instant :: now ( ) ;
155149 }
150+ _ => handle_key ( & mut app, key) . await ,
156151 }
157- _ => { }
158152 }
159153 }
160154
@@ -418,11 +412,10 @@ fn render_status_bar<B: tui::backend::Backend>(f: &mut tui::Frame<B>, app: &AppS
418412 } ;
419413
420414 let status = if app. loading {
421- format ! ( "Loading {}..." , source_label )
415+ format ! ( "Loading {source_label }..." )
422416 } else {
423417 let x = & * format ! (
424- "RTFM // {} PAGE [Tab:Switch /:Search n/N:Next/Prev t:Toggle]" ,
425- source_label
418+ "RTFM // {source_label} PAGE [Tab:Switch /:Search n/N:Next/Prev t:Toggle]"
426419 ) ;
427420 match app. focus {
428421 Focus :: CommandList => "RTFM // COMMAND LIST [Tab:Switch]" ,
@@ -510,7 +503,7 @@ fn render_command_list_items<B: tui::backend::Backend>(
510503 . iter ( )
511504 . map ( |cmd| {
512505 let prefix = { " " } ;
513- ListItem :: new ( format ! ( "{}{}" , prefix , cmd ) )
506+ ListItem :: new ( format ! ( "{prefix}{cmd}" ) )
514507 } )
515508 . collect ( ) ;
516509
0 commit comments