@@ -215,10 +215,7 @@ impl BytesCell {
215215 fn new ( bytes : u64 , block_size : & BlockSize ) -> Self {
216216 Self {
217217 bytes,
218- scaled : {
219- let BlockSize :: Bytes ( d) = block_size;
220- ( bytes as f64 / * d as f64 ) . ceil ( ) as u64
221- } ,
218+ scaled : ( bytes as f64 / block_size. as_u64 ( ) as f64 ) . ceil ( ) as u64 ,
222219 }
223220 }
224221}
@@ -308,14 +305,21 @@ impl<'a> RowFormatter<'a> {
308305 let size = bytes_column. scaled ;
309306 let s = if let Some ( h) = self . options . human_readable {
310307 let size = if self . is_total_row {
311- let BlockSize :: Bytes ( d ) = self . options . block_size ;
308+ let d = self . options . block_size . as_u64 ( ) ;
312309 d * size
313310 } else {
314311 bytes_column. bytes
315312 } ;
316313 to_magnitude_and_suffix ( size. into ( ) , SuffixType :: HumanReadable ( h) , true )
317- } else {
318- size. to_string ( )
314+ } else {
315+ match & self . options . block_size {
316+ /// if it has a suffix, append it to the size (but not on the 'total' row)
317+ BlockSize :: PrefixedBytes ( _, suffix) if !self . is_total_row => {
318+ format ! ( "{}{}" , size, suffix)
319+ }
320+ /// else, just print the raw number as before
321+ _ => size. to_string ( ) ,
322+ }
319323 } ;
320324 Cell :: from_ascii_string ( s)
321325 }
@@ -327,7 +331,14 @@ impl<'a> RowFormatter<'a> {
327331 let s = if let Some ( h) = self . options . human_readable {
328332 to_magnitude_and_suffix ( size, SuffixType :: HumanReadable ( h) , true )
329333 } else {
330- size. to_string ( )
334+ match & self . options . block_size {
335+ /// if it has a suffix, append it to the size (but not on the 'total' row)
336+ BlockSize :: PrefixedBytes ( _, suffix) if !self . is_total_row => {
337+ format ! ( "{}{}" , size, suffix)
338+ }
339+ /// else, just print the raw number as before
340+ _ => size. to_string ( ) ,
341+ }
331342 } ;
332343 Cell :: from_ascii_string ( s)
333344 }
0 commit comments