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> {
352
352
self . message . push_str ( & self . search_query ) ;
353
353
self . message . push ( '|' ) ;
354
354
355
- if self . search_query . is_empty ( ) { return ; }
355
+ if self . search_query . is_empty ( ) {
356
+ return ;
357
+ }
356
358
357
359
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 ( ) ) ) ;
370
369
371
370
match idx {
372
371
Some ( exercise_ind) => {
@@ -377,17 +376,6 @@ impl<'a> ListState<'a> {
377
376
self . message . push_str ( & msg) ;
378
377
}
379
378
}
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
- }
391
379
}
392
380
393
381
// Return `true` if there was something to select.
You can’t perform that action at this time.
0 commit comments