@@ -66,8 +66,8 @@ impl DataType {
66
66
pub fn display_labels ( & self , endian : object:: Endianness , bytes : & [ u8 ] ) -> Vec < String > {
67
67
let mut strs = Vec :: new ( ) ;
68
68
for ( literal, label_override) in self . display_literals ( endian, bytes) {
69
- let label = label_override. unwrap_or_else ( || format ! ( "{}" , self ) ) ;
70
- strs. push ( format ! ( "{}: {}" , label , literal ) )
69
+ let label = label_override. unwrap_or_else ( || format ! ( "{self}" ) ) ;
70
+ strs. push ( format ! ( "{label }: {literal}" ) )
71
71
}
72
72
strs
73
73
}
@@ -100,31 +100,31 @@ impl DataType {
100
100
match self {
101
101
DataType :: Int8 => {
102
102
let i = i8:: from_ne_bytes ( bytes. try_into ( ) . unwrap ( ) ) ;
103
- strs. push ( ( format ! ( "{:#x}" , i ) , None ) ) ;
103
+ strs. push ( ( format ! ( "{i :#x}" ) , None ) ) ;
104
104
105
105
if i < 0 {
106
106
strs. push ( ( format ! ( "{:#x}" , ReallySigned ( i) ) , None ) ) ;
107
107
}
108
108
}
109
109
DataType :: Int16 => {
110
110
let i = endian. read_i16_bytes ( bytes. try_into ( ) . unwrap ( ) ) ;
111
- strs. push ( ( format ! ( "{:#x}" , i ) , None ) ) ;
111
+ strs. push ( ( format ! ( "{i :#x}" ) , None ) ) ;
112
112
113
113
if i < 0 {
114
114
strs. push ( ( format ! ( "{:#x}" , ReallySigned ( i) ) , None ) ) ;
115
115
}
116
116
}
117
117
DataType :: Int32 => {
118
118
let i = endian. read_i32_bytes ( bytes. try_into ( ) . unwrap ( ) ) ;
119
- strs. push ( ( format ! ( "{:#x}" , i ) , None ) ) ;
119
+ strs. push ( ( format ! ( "{i :#x}" ) , None ) ) ;
120
120
121
121
if i < 0 {
122
122
strs. push ( ( format ! ( "{:#x}" , ReallySigned ( i) ) , None ) ) ;
123
123
}
124
124
}
125
125
DataType :: Int64 => {
126
126
let i = endian. read_i64_bytes ( bytes. try_into ( ) . unwrap ( ) ) ;
127
- strs. push ( ( format ! ( "{:#x}" , i ) , None ) ) ;
127
+ strs. push ( ( format ! ( "{i :#x}" ) , None ) ) ;
128
128
129
129
if i < 0 {
130
130
strs. push ( ( format ! ( "{:#x}" , ReallySigned ( i) ) , None ) ) ;
@@ -151,16 +151,16 @@ impl DataType {
151
151
) ) ;
152
152
}
153
153
DataType :: Bytes => {
154
- strs. push ( ( format ! ( "{:#?}" , bytes ) , None ) ) ;
154
+ strs. push ( ( format ! ( "{bytes :#?}" ) , None ) ) ;
155
155
}
156
156
DataType :: String => {
157
157
if let Ok ( cstr) = CStr :: from_bytes_until_nul ( bytes) {
158
- strs. push ( ( format ! ( "{:?}" , cstr ) , None ) ) ;
158
+ strs. push ( ( format ! ( "{cstr :?}" ) , None ) ) ;
159
159
}
160
160
if let Some ( nul_idx) = bytes. iter ( ) . position ( |& c| c == b'\0' ) {
161
161
let ( cow, _, had_errors) = SHIFT_JIS . decode ( & bytes[ ..nul_idx] ) ;
162
162
if !had_errors {
163
- let str = format ! ( "{:?}" , cow ) ;
163
+ let str = format ! ( "{cow :?}" ) ;
164
164
// Only add the Shift JIS string if it's different from the ASCII string.
165
165
if !strs. iter ( ) . any ( |x| x. 0 == str) {
166
166
strs. push ( ( str, Some ( "Shift JIS" . into ( ) ) ) ) ;
0 commit comments