@@ -118,22 +118,21 @@ impl<'a> ListState<'a> {
118
118
}
119
119
120
120
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
123
123
. name
124
124
. find ( & self . search_query )
125
125
. and_then ( |ind| exercise. name . split_at_checked ( ind) )
126
126
. and_then ( |( pre_highlight, rest) | {
127
127
rest. split_at_checked ( self . search_query . len ( ) )
128
128
. map ( |x| ( pre_highlight, x. 0 , x. 1 ) )
129
129
} )
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) ;
137
136
}
138
137
139
138
writer. write_str ( exercise. name )
0 commit comments