@@ -186,7 +186,7 @@ struct Opt {
186
186
terminal_width : Option < NonZeroU64 > ,
187
187
188
188
/// Print a table showing how different types of bytes are colored.
189
- #[ arg( short ( 't' ) , long) ]
189
+ #[ arg( long) ]
190
190
print_color_table : bool ,
191
191
}
192
192
@@ -429,10 +429,9 @@ fn run() -> Result<()> {
429
429
430
430
let character_table = opt. character_table ;
431
431
432
- let stdout = io:: stdout ( ) ;
433
- let mut stdout_lock = BufWriter :: new ( stdout. lock ( ) ) ;
432
+ let mut stdout = BufWriter :: new ( io:: stdout ( ) . lock ( ) ) ;
434
433
435
- let mut printer = PrinterBuilder :: new ( & mut stdout_lock )
434
+ let mut printer = PrinterBuilder :: new ( & mut stdout )
436
435
. show_color ( show_color)
437
436
. show_char_panel ( show_char_panel)
438
437
. show_position_panel ( show_position_panel)
@@ -489,38 +488,37 @@ impl From<NonNegativeI64> for u64 {
489
488
}
490
489
491
490
fn print_color_table ( ) -> io:: Result < ( ) > {
492
- let stdout = io:: stdout ( ) ;
493
- let mut stdout_lock = BufWriter :: new ( stdout. lock ( ) ) ;
491
+ let mut stdout = BufWriter :: new ( io:: stdout ( ) . lock ( ) ) ;
494
492
495
- writeln ! ( stdout_lock , "hexyl color reference:\n " ) ?;
493
+ writeln ! ( stdout , "hexyl color reference:\n " ) ?;
496
494
497
495
// NULL bytes
498
- stdout_lock . write_all ( COLOR_NULL ) ?;
499
- writeln ! ( stdout_lock , "⋄ NULL bytes (0x00)" ) ?;
500
- stdout_lock . write_all ( COLOR_RESET ) ?;
496
+ stdout . write_all ( COLOR_NULL ) ?;
497
+ writeln ! ( stdout , "⋄ NULL bytes (0x00)" ) ?;
498
+ stdout . write_all ( COLOR_RESET ) ?;
501
499
502
500
// ASCII printable
503
- stdout_lock . write_all ( COLOR_ASCII_PRINTABLE ) ?;
504
- writeln ! ( stdout_lock , "a ASCII printable characters (0x20 - 0x7E)" ) ?;
505
- stdout_lock . write_all ( COLOR_RESET ) ?;
501
+ stdout . write_all ( COLOR_ASCII_PRINTABLE ) ?;
502
+ writeln ! ( stdout , "a ASCII printable characters (0x20 - 0x7E)" ) ?;
503
+ stdout . write_all ( COLOR_RESET ) ?;
506
504
507
505
// ASCII whitespace
508
- stdout_lock . write_all ( COLOR_ASCII_WHITESPACE ) ?;
509
- writeln ! ( stdout_lock , "_ ASCII whitespace (0x09 - 0x0D, 0x20)" ) ?;
510
- stdout_lock . write_all ( COLOR_RESET ) ?;
506
+ stdout . write_all ( COLOR_ASCII_WHITESPACE ) ?;
507
+ writeln ! ( stdout , "_ ASCII whitespace (0x09 - 0x0D, 0x20)" ) ?;
508
+ stdout . write_all ( COLOR_RESET ) ?;
511
509
512
510
// ASCII other
513
- stdout_lock . write_all ( COLOR_ASCII_OTHER ) ?;
511
+ stdout . write_all ( COLOR_ASCII_OTHER ) ?;
514
512
writeln ! (
515
- stdout_lock ,
513
+ stdout ,
516
514
"• ASCII control characters (except NULL and whitespace)"
517
515
) ?;
518
- stdout_lock . write_all ( COLOR_RESET ) ?;
516
+ stdout . write_all ( COLOR_RESET ) ?;
519
517
520
518
// Non-ASCII
521
- stdout_lock . write_all ( COLOR_NONASCII ) ?;
522
- writeln ! ( stdout_lock , "× Non-ASCII bytes (0x80 - 0xFF)" ) ?;
523
- stdout_lock . write_all ( COLOR_RESET ) ?;
519
+ stdout . write_all ( COLOR_NONASCII ) ?;
520
+ writeln ! ( stdout , "× Non-ASCII bytes (0x80 - 0xFF)" ) ?;
521
+ stdout . write_all ( COLOR_RESET ) ?;
524
522
525
523
Ok ( ( ) )
526
524
}
0 commit comments