@@ -118,22 +118,21 @@ impl<'a> ListState<'a> {
118118 }
119119
120120 fn draw_exercise_name ( & self , writer : & mut MaxLenWriter , exercise : & Exercise ) -> io:: Result < ( ) > {
121- if !self . search_query . is_empty ( ) {
122- if let Some ( ( pre_highlight, highlight, post_highlight) ) = exercise
121+ if !self . search_query . is_empty ( )
122+ && let Some ( ( pre_highlight, highlight, post_highlight) ) = exercise
123123 . name
124124 . find ( & self . search_query )
125125 . and_then ( |ind| exercise. name . split_at_checked ( ind) )
126126 . and_then ( |( pre_highlight, rest) | {
127127 rest. split_at_checked ( self . search_query . len ( ) )
128128 . map ( |x| ( pre_highlight, x. 0 , x. 1 ) )
129129 } )
130- {
131- writer. write_str ( pre_highlight) ?;
132- writer. stdout . queue ( SetForegroundColor ( Color :: Magenta ) ) ?;
133- writer. write_str ( highlight) ?;
134- writer. stdout . queue ( SetForegroundColor ( Color :: Reset ) ) ?;
135- return writer. write_str ( post_highlight) ;
136- }
130+ {
131+ writer. write_str ( pre_highlight) ?;
132+ writer. stdout . queue ( SetForegroundColor ( Color :: Magenta ) ) ?;
133+ writer. write_str ( highlight) ?;
134+ writer. stdout . queue ( SetForegroundColor ( Color :: Reset ) ) ?;
135+ return writer. write_str ( post_highlight) ;
137136 }
138137
139138 writer. write_str ( exercise. name )
0 commit comments