@@ -205,24 +205,22 @@ impl<'a> Tokens<'a> {
205205 let mut whole_string = String :: new ( ) ;
206206 let mut color = & DynColors :: Ansi ( AnsiColors :: Default ) ;
207207
208- self . truncate ( start, end) . for_each ( |token| {
209- match token {
210- Token :: Char ( chr) => {
211- width = width. saturating_sub ( 1 ) ;
212- colored_segment. push ( chr) ;
213- }
214- Token :: Color ( col) => {
215- add_styled_segment ( & mut whole_string, & colored_segment, * color, bold) ;
216- colored_segment = String :: new ( ) ;
217- color = colors
218- . get ( col as usize )
219- . unwrap_or ( & DynColors :: Ansi ( AnsiColors :: Default ) ) ;
220- }
221- Token :: Space => {
222- width = width. saturating_sub ( 1 ) ;
223- colored_segment. push ( ' ' )
224- }
225- } ;
208+ self . truncate ( start, end) . for_each ( |token| match token {
209+ Token :: Char ( chr) => {
210+ width = width. saturating_sub ( 1 ) ;
211+ colored_segment. push ( chr) ;
212+ }
213+ Token :: Color ( col) => {
214+ add_styled_segment ( & mut whole_string, & colored_segment, * color, bold) ;
215+ colored_segment = String :: new ( ) ;
216+ color = colors
217+ . get ( col as usize )
218+ . unwrap_or ( & DynColors :: Ansi ( AnsiColors :: Default ) ) ;
219+ }
220+ Token :: Space => {
221+ width = width. saturating_sub ( 1 ) ;
222+ colored_segment. push ( ' ' ) ;
223+ }
226224 } ) ;
227225
228226 add_styled_segment ( & mut whole_string, & colored_segment, * color, bold) ;
@@ -267,15 +265,15 @@ fn token<R>(s: &str, predicate: impl FnOnce(char) -> Option<R>) -> ParseResult<R
267265
268266/// Parses a color indicator of the format `{n}` where `n` is a digit.
269267fn color_token ( s : & str ) -> ParseResult < Token > {
270- let ( s, _ ) = token ( s, succeed_when ( |c| c == '{' ) ) ?;
268+ let ( s, ( ) ) = token ( s, succeed_when ( |c| c == '{' ) ) ?;
271269 let ( s, color_index) = token ( s, |c| c. to_digit ( 10 ) ) ?;
272- let ( s, _ ) = token ( s, succeed_when ( |c| c == '}' ) ) ?;
270+ let ( s, ( ) ) = token ( s, succeed_when ( |c| c == '}' ) ) ?;
273271 Some ( ( s, Token :: Color ( color_index) ) )
274272}
275273
276274/// Parses a space.
277275fn space_token ( s : & str ) -> ParseResult < Token > {
278- token ( s, succeed_when ( |c| c == ' ' ) ) . map ( |( s, _ ) | ( s, Token :: Space ) )
276+ token ( s, succeed_when ( |c| c == ' ' ) ) . map ( |( s, ( ) ) | ( s, Token :: Space ) )
279277}
280278
281279/// Parses any arbitrary character. This cannot fail.
0 commit comments