Tweak file size formatting to one decimal place

Fixes #821
pull/832/head
Wilfred Hughes 2025-04-08 08:51:42 +07:00
parent aa04647514
commit 083efd06f6
2 changed files with 4 additions and 3 deletions

@ -104,7 +104,7 @@ sample_files/html_simple_1.html sample_files/html_simple_2.html
bb129dce38cd26eac81ca52d2016bade -
sample_files/huge_cpp_1.cpp sample_files/huge_cpp_2.cpp
3a500d7b0c58fa6874eb0e4f5493a9e5 -
47e26aa5975cd57344ccbf9f366466ec -
sample_files/identical_1.scala sample_files/identical_2.scala
15c5a789e644348cb7e0de051ff4b63e -

@ -81,7 +81,7 @@ static GLOBAL: MiMalloc = MiMalloc;
use std::path::Path;
use std::{env, thread};
use humansize::{format_size, BINARY};
use humansize::{format_size, FormatSizeOptions, BINARY};
use owo_colors::OwoColorize;
use rayon::prelude::*;
use strum::IntoEnumIterator;
@ -705,10 +705,11 @@ fn diff_file_content(
}
}
Err(tsp::ExceededByteLimit(num_bytes)) => {
let format_options = FormatSizeOptions::from(BINARY).decimal_places(1);
let file_format = FileFormat::TextFallback {
reason: format!(
"{} exceeded DFT_BYTE_LIMIT",
&format_size(num_bytes, BINARY)
&format_size(num_bytes, format_options)
),
};