File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -193,18 +193,19 @@ impl<'a> DigitInfo<'a> {
193
193
self . suffix. unwrap_or( "" )
194
194
)
195
195
} else {
196
- let mut hint = self . digits
196
+ let filtered_digits_vec = self . digits
197
197
. chars ( )
198
- . rev ( )
199
198
. filter ( |& c| c != '_' )
200
- . collect :: < Vec < _ > > ( )
199
+ . rev ( )
200
+ . collect :: < Vec < _ > > ( ) ;
201
+ let mut hint = filtered_digits_vec
201
202
. chunks ( group_size)
202
203
. map ( |chunk| chunk. into_iter ( ) . rev ( ) . collect ( ) )
203
204
. rev ( )
204
205
. collect :: < Vec < String > > ( )
205
206
. join ( "_" ) ;
206
207
// Forces hexadecimal values to be grouped by 4 being filled with zeroes (e.g 0x00ab_cdef)
207
- let nb_digits_to_fill = self . digits . chars ( ) . filter ( | & c| c != '_' ) . collect :: < Vec < _ > > ( ) . len ( ) % 4 ;
208
+ let nb_digits_to_fill = filtered_digits_vec . len ( ) % 4 ;
208
209
if self . radix == Radix :: Hexadecimal && nb_digits_to_fill != 0 {
209
210
hint = format ! ( "{:0>4}{}" , & hint[ ..nb_digits_to_fill] , & hint[ nb_digits_to_fill..] ) ;
210
211
}
You can’t perform that action at this time.
0 commit comments