1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-08-04 15:07:47 +00:00

refactor/polish ~ fix cargo clippy complaints (match function signatures)

This commit is contained in:
Roy Ivy III 2019-12-28 12:07:09 -06:00
parent c6817aefb3
commit c6e9808224

View file

@ -254,13 +254,13 @@ With no FILE, or when FILE is -, read standard input.",
SortMode::HumanNumeric => human_numeric_size_compare,
SortMode::Month => month_compare,
SortMode::Version => version_compare,
SortMode::Default => String::cmp,
SortMode::Default => default_compare,
});
if !settings.stable {
match settings.mode {
SortMode::Default => {}
_ => settings.compare_fns.push(String::cmp),
_ => settings.compare_fns.push(default_compare),
}
}
@ -395,6 +395,10 @@ fn permissive_f64_parse(a: &str) -> f64 {
}
}
fn default_compare(a: &str, b: &str) -> Ordering {
a.cmp(b)
}
/// Compares two floating point numbers, with errors being assumed to be -inf.
/// Stops coercing at the first whitespace char, so 1e2 will parse as 100 but
/// 1,000 will parse as -inf.