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.