1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 12:07:46 +00:00

Ran rustfmt

This commit is contained in:
electricboogie 2021-04-25 22:41:11 -05:00
parent 6654519c7d
commit c01c6a7d78
2 changed files with 23 additions and 30 deletions

View file

@ -183,16 +183,16 @@ where
let seq_size = seq.get_size();
total_read += seq_size;
// GNU minimum is 16 * (sizeof struct + 2), but GNU uses about
// 1/10 the memory that we do. And GNU even says in the code it may
// GNU minimum is 16 * (sizeof struct + 2), but GNU uses about
// 1/10 the memory that we do. And GNU even says in the code it may
// not work on small buffer sizes.
//
// The following seems to work pretty well, and has about the same max
//
// The following seems to work pretty well, and has about the same max
// RSS as lower minimum values.
//
//
let minimum_buffer_size: u64 = iter_size as u64 * seq_size / 8;
adjusted_buffer_size =
adjusted_buffer_size =
// Grow buffer size for a struct/Line larger than buffer
if adjusted_buffer_size < seq_size {
seq_size
@ -233,14 +233,13 @@ where
//
const MINIMUM_READBACK_BUFFER: u64 = 8200;
let right_sized_buffer = adjusted_buffer_size
.checked_div(iter.chunks)
.unwrap_or(adjusted_buffer_size);
iter.max_per_chunk =
if right_sized_buffer > MINIMUM_READBACK_BUFFER {
right_sized_buffer
} else {
MINIMUM_READBACK_BUFFER
};
.checked_div(iter.chunks)
.unwrap_or(adjusted_buffer_size);
iter.max_per_chunk = if right_sized_buffer > MINIMUM_READBACK_BUFFER {
right_sized_buffer
} else {
MINIMUM_READBACK_BUFFER
};
iter.buffers = vec![VecDeque::new(); iter.chunks as usize];
iter.chunk_offsets = vec![0 as u64; iter.chunks as usize];
for chunk_num in 0..iter.chunks {

View file

@ -92,17 +92,12 @@ static THOUSANDS_SEP: char = ',';
static NEGATIVE: char = '-';
static POSITIVE: char = '+';
#[cfg(any(
target_os = "windows",
))]
#[cfg(any(target_os = "windows",))]
static DEFAULT_TMPDIR: &str = r"%USERPROFILE%\AppData\Local\Temp";
#[cfg(not(any(
target_os = "windows",
)))]
#[cfg(not(any(target_os = "windows",)))]
static DEFAULT_TMPDIR: &str = r"/tmp";
static DEFAULT_BUF_SIZE: usize = usize::MAX;
#[derive(Eq, Ord, PartialEq, PartialOrd, Clone, Copy)]
@ -1073,9 +1068,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
settings.tmp_dir = PathBuf::from(result);
} else {
for (key, value) in env::vars_os() {
if key == OsString::from("TMPDIR")
|| key == OsString::from("TEMP")
|| key == OsString::from("TMP")
if key == OsString::from("TMPDIR")
|| key == OsString::from("TEMP")
|| key == OsString::from("TMP")
{
settings.tmp_dir = PathBuf::from(value);
break;
@ -1311,11 +1306,10 @@ fn compare_by(a: &Line, b: &Line, global_settings: &GlobalSettings) -> Ordering
(a_str, a_selection.num_cache.as_num_info()),
(b_str, b_selection.num_cache.as_num_info()),
),
SortMode::GeneralNumeric => {
general_numeric_compare(
general_f64_parse(&a_str[get_leading_gen(a_str)]),
general_f64_parse(&b_str[get_leading_gen(b_str)]),)
}
SortMode::GeneralNumeric => general_numeric_compare(
general_f64_parse(&a_str[get_leading_gen(a_str)]),
general_f64_parse(&b_str[get_leading_gen(b_str)]),
),
SortMode::Month => month_compare(a_str, b_str),
SortMode::Version => version_compare(a_str, b_str),
SortMode::Default => default_compare(a_str, b_str),