From c6e98082242a9f5d118d40355a9a861dca60743e Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 28 Dec 2019 12:07:09 -0600 Subject: [PATCH] refactor/polish ~ fix `cargo clippy` complaints (match function signatures) --- src/sort/sort.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/sort/sort.rs b/src/sort/sort.rs index 81ea58a26..1bfa13122 100644 --- a/src/sort/sort.rs +++ b/src/sort/sort.rs @@ -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.