File tree Expand file tree Collapse file tree 1 file changed +12
-24
lines changed
Expand file tree Collapse file tree 1 file changed +12
-24
lines changed Original file line number Diff line number Diff line change @@ -352,21 +352,20 @@ impl<'a> ListState<'a> {
352352 self . message . push_str ( & self . search_query ) ;
353353 self . message . push ( '|' ) ;
354354
355- if self . search_query . is_empty ( ) { return ; }
355+ if self . search_query . is_empty ( ) {
356+ return ;
357+ }
356358
357359 let idx = self
358- . app_state
359- . exercises ( )
360- . iter ( )
361- . filter_map ( |exercise| {
362- match self . filter ( ) {
363- Filter :: None => Some ( exercise) ,
364- Filter :: Done if exercise. done => Some ( exercise) ,
365- Filter :: Pending if !exercise. done => Some ( exercise) ,
366- _ => None ,
367- }
368- } )
369- . position ( |exercise| exercise. name . contains ( self . search_query . as_str ( ) ) ) ;
360+ . app_state
361+ . exercises ( )
362+ . iter ( )
363+ . filter ( |exercise| match self . filter ( ) {
364+ Filter :: None => true ,
365+ Filter :: Done => exercise. done ,
366+ Filter :: Pending => !exercise. done ,
367+ } )
368+ . position ( |exercise| exercise. name . contains ( self . search_query . as_str ( ) ) ) ;
370369
371370 match idx {
372371 Some ( exercise_ind) => {
@@ -377,17 +376,6 @@ impl<'a> ListState<'a> {
377376 self . message . push_str ( & msg) ;
378377 }
379378 }
380-
381- match idx {
382- Some ( x) => {
383- let exercise_ind = x;
384- self . scroll_state . set_selected ( exercise_ind) ;
385- }
386- None => {
387- let msg = String :: from ( " (not found)" ) ;
388- self . message . push_str ( & msg) ;
389- }
390- }
391379 }
392380
393381 // Return `true` if there was something to select.
You can’t perform that action at this time.
0 commit comments