@@ -73,7 +73,7 @@ impl fmt::Display for BStr {
7373 b'\r' => f. write_str ( "\\ r" ) ?,
7474 // Printable characters.
7575 0x20 ..=0x7e => f. write_char ( b as char ) ?,
76- _ => write ! ( f, "\\ x{:02x}" , b ) ?,
76+ _ => write ! ( f, "\\ x{b :02x}" ) ?,
7777 }
7878 }
7979 Ok ( ( ) )
@@ -109,7 +109,7 @@ impl fmt::Debug for BStr {
109109 b'\\' => f. write_str ( "\\ \\ " ) ?,
110110 // Printable characters.
111111 0x20 ..=0x7e => f. write_char ( b as char ) ?,
112- _ => write ! ( f, "\\ x{:02x}" , b ) ?,
112+ _ => write ! ( f, "\\ x{b :02x}" ) ?,
113113 }
114114 }
115115 f. write_char ( '"' )
@@ -447,7 +447,7 @@ impl fmt::Display for CStr {
447447 // Printable character.
448448 f. write_char ( c as char ) ?;
449449 } else {
450- write ! ( f, "\\ x{:02x}" , c ) ?;
450+ write ! ( f, "\\ x{c :02x}" ) ?;
451451 }
452452 }
453453 Ok ( ( ) )
@@ -479,7 +479,7 @@ impl fmt::Debug for CStr {
479479 // Printable characters.
480480 b'\"' => f. write_str ( "\\ \" " ) ?,
481481 0x20 ..=0x7e => f. write_char ( c as char ) ?,
482- _ => write ! ( f, "\\ x{:02x}" , c ) ?,
482+ _ => write ! ( f, "\\ x{c :02x}" ) ?,
483483 }
484484 }
485485 f. write_str ( "\" " )
@@ -641,13 +641,13 @@ mod tests {
641641 #[ test]
642642 fn test_cstr_display ( ) {
643643 let hello_world = CStr :: from_bytes_with_nul ( b"hello, world!\0 " ) . unwrap ( ) ;
644- assert_eq ! ( format!( "{}" , hello_world ) , "hello, world!" ) ;
644+ assert_eq ! ( format!( "{hello_world}" ) , "hello, world!" ) ;
645645 let non_printables = CStr :: from_bytes_with_nul ( b"\x01 \x09 \x0a \0 " ) . unwrap ( ) ;
646- assert_eq ! ( format!( "{}" , non_printables ) , "\\ x01\\ x09\\ x0a" ) ;
646+ assert_eq ! ( format!( "{non_printables}" ) , "\\ x01\\ x09\\ x0a" ) ;
647647 let non_ascii = CStr :: from_bytes_with_nul ( b"d\xe9 j\xe0 vu\0 " ) . unwrap ( ) ;
648- assert_eq ! ( format!( "{}" , non_ascii ) , "d\\ xe9j\\ xe0 vu" ) ;
648+ assert_eq ! ( format!( "{non_ascii}" ) , "d\\ xe9j\\ xe0 vu" ) ;
649649 let good_bytes = CStr :: from_bytes_with_nul ( b"\xf0 \x9f \xa6 \x80 \0 " ) . unwrap ( ) ;
650- assert_eq ! ( format!( "{}" , good_bytes ) , "\\ xf0\\ x9f\\ xa6\\ x80" ) ;
650+ assert_eq ! ( format!( "{good_bytes}" ) , "\\ xf0\\ x9f\\ xa6\\ x80" ) ;
651651 }
652652
653653 #[ test]
@@ -658,47 +658,47 @@ mod tests {
658658 bytes[ i as usize ] = i. wrapping_add ( 1 ) ;
659659 }
660660 let cstr = CStr :: from_bytes_with_nul ( & bytes) . unwrap ( ) ;
661- assert_eq ! ( format!( "{}" , cstr ) , ALL_ASCII_CHARS ) ;
661+ assert_eq ! ( format!( "{cstr}" ) , ALL_ASCII_CHARS ) ;
662662 }
663663
664664 #[ test]
665665 fn test_cstr_debug ( ) {
666666 let hello_world = CStr :: from_bytes_with_nul ( b"hello, world!\0 " ) . unwrap ( ) ;
667- assert_eq ! ( format!( "{:?}" , hello_world ) , "\" hello, world!\" " ) ;
667+ assert_eq ! ( format!( "{hello_world :?}" ) , "\" hello, world!\" " ) ;
668668 let non_printables = CStr :: from_bytes_with_nul ( b"\x01 \x09 \x0a \0 " ) . unwrap ( ) ;
669- assert_eq ! ( format!( "{:?}" , non_printables ) , "\" \\ x01\\ x09\\ x0a\" " ) ;
669+ assert_eq ! ( format!( "{non_printables :?}" ) , "\" \\ x01\\ x09\\ x0a\" " ) ;
670670 let non_ascii = CStr :: from_bytes_with_nul ( b"d\xe9 j\xe0 vu\0 " ) . unwrap ( ) ;
671- assert_eq ! ( format!( "{:?}" , non_ascii ) , "\" d\\ xe9j\\ xe0 vu\" " ) ;
671+ assert_eq ! ( format!( "{non_ascii :?}" ) , "\" d\\ xe9j\\ xe0 vu\" " ) ;
672672 let good_bytes = CStr :: from_bytes_with_nul ( b"\xf0 \x9f \xa6 \x80 \0 " ) . unwrap ( ) ;
673- assert_eq ! ( format!( "{:?}" , good_bytes ) , "\" \\ xf0\\ x9f\\ xa6\\ x80\" " ) ;
673+ assert_eq ! ( format!( "{good_bytes :?}" ) , "\" \\ xf0\\ x9f\\ xa6\\ x80\" " ) ;
674674 }
675675
676676 #[ test]
677677 fn test_bstr_display ( ) {
678678 let hello_world = BStr :: from_bytes ( b"hello, world!" ) ;
679- assert_eq ! ( format!( "{}" , hello_world ) , "hello, world!" ) ;
679+ assert_eq ! ( format!( "{hello_world}" ) , "hello, world!" ) ;
680680 let escapes = BStr :: from_bytes ( b"_\t _\n _\r _\\ _\' _\" _" ) ;
681- assert_eq ! ( format!( "{}" , escapes ) , "_\\ t_\\ n_\\ r_\\ _'_\" _" ) ;
681+ assert_eq ! ( format!( "{escapes}" ) , "_\\ t_\\ n_\\ r_\\ _'_\" _" ) ;
682682 let others = BStr :: from_bytes ( b"\x01 " ) ;
683- assert_eq ! ( format!( "{}" , others ) , "\\ x01" ) ;
683+ assert_eq ! ( format!( "{others}" ) , "\\ x01" ) ;
684684 let non_ascii = BStr :: from_bytes ( b"d\xe9 j\xe0 vu" ) ;
685- assert_eq ! ( format!( "{}" , non_ascii ) , "d\\ xe9j\\ xe0 vu" ) ;
685+ assert_eq ! ( format!( "{non_ascii}" ) , "d\\ xe9j\\ xe0 vu" ) ;
686686 let good_bytes = BStr :: from_bytes ( b"\xf0 \x9f \xa6 \x80 " ) ;
687- assert_eq ! ( format!( "{}" , good_bytes ) , "\\ xf0\\ x9f\\ xa6\\ x80" ) ;
687+ assert_eq ! ( format!( "{good_bytes}" ) , "\\ xf0\\ x9f\\ xa6\\ x80" ) ;
688688 }
689689
690690 #[ test]
691691 fn test_bstr_debug ( ) {
692692 let hello_world = BStr :: from_bytes ( b"hello, world!" ) ;
693- assert_eq ! ( format!( "{:?}" , hello_world ) , "\" hello, world!\" " ) ;
693+ assert_eq ! ( format!( "{hello_world :?}" ) , "\" hello, world!\" " ) ;
694694 let escapes = BStr :: from_bytes ( b"_\t _\n _\r _\\ _\' _\" _" ) ;
695- assert_eq ! ( format!( "{:?}" , escapes ) , "\" _\\ t_\\ n_\\ r_\\ \\ _'_\\ \" _\" " ) ;
695+ assert_eq ! ( format!( "{escapes :?}" ) , "\" _\\ t_\\ n_\\ r_\\ \\ _'_\\ \" _\" " ) ;
696696 let others = BStr :: from_bytes ( b"\x01 " ) ;
697- assert_eq ! ( format!( "{:?}" , others ) , "\" \\ x01\" " ) ;
697+ assert_eq ! ( format!( "{others :?}" ) , "\" \\ x01\" " ) ;
698698 let non_ascii = BStr :: from_bytes ( b"d\xe9 j\xe0 vu" ) ;
699- assert_eq ! ( format!( "{:?}" , non_ascii ) , "\" d\\ xe9j\\ xe0 vu\" " ) ;
699+ assert_eq ! ( format!( "{non_ascii :?}" ) , "\" d\\ xe9j\\ xe0 vu\" " ) ;
700700 let good_bytes = BStr :: from_bytes ( b"\xf0 \x9f \xa6 \x80 " ) ;
701- assert_eq ! ( format!( "{:?}" , good_bytes ) , "\" \\ xf0\\ x9f\\ xa6\\ x80\" " ) ;
701+ assert_eq ! ( format!( "{good_bytes :?}" ) , "\" \\ xf0\\ x9f\\ xa6\\ x80\" " ) ;
702702 }
703703}
704704
0 commit comments