Replace unmaintained human-sort with numeric-sort (#1759)

* Replace unmaintained human-sort with numeric-sort

human-sort is unmaintained and causes panic in recent Rust versions.
This commit replaces all usages of human_sort::compare with
numeric_sort::cmp to fix the 'total order' panic issue.

Fixes #1758
This commit is contained in:
Shawn 2025-07-04 23:00:03 +02:00 committed by GitHub
parent 02f6f5cb49
commit 830ec2df85
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 12 additions and 13 deletions

14
Cargo.lock generated
View file

@ -1906,12 +1906,6 @@ version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
[[package]]
name = "human-sort"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "140a09c9305e6d5e557e2ed7cbc68e05765a7d4213975b87cb04920689cc6219"
[[package]]
name = "humantime"
version = "2.2.0"
@ -2506,12 +2500,12 @@ dependencies = [
"headers",
"http 1.3.1",
"http-serde",
"human-sort",
"humantime",
"humantime-serde",
"indicatif",
"log",
"lychee-lib",
"numeric-sort",
"openssl-sys",
"pad",
"predicates",
@ -2786,6 +2780,12 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3"
[[package]]
name = "numeric-sort"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2dcb6053ab98da45585315f79932c5c9821fab8efa4301c0d7b637c91630eb7"
[[package]]
name = "object"
version = "0.36.7"

View file

@ -31,7 +31,7 @@ http = "1.3.1"
http-serde = "2.1.1"
humantime = "2.2.0"
humantime-serde = "1.1.1"
human-sort = "0.2.2"
numeric-sort = "0.1.5"
indicatif = "0.17.11"
log = "0.4.27"
openssl-sys = { version = "0.9.108", optional = true }

View file

@ -52,7 +52,7 @@ impl Display for CompactResponseStats {
let mut sorted_suggestions: Vec<_> = suggestions.iter().collect();
sorted_suggestions.sort_by(|a, b| {
let (a, b) = (a.to_string().to_lowercase(), b.to_string().to_lowercase());
human_sort::compare(&a, &b)
numeric_sort::cmp(&a, &b)
});
writeln!(f, "\n\u{2139} Suggestions")?;

View file

@ -4,7 +4,6 @@ use crate::{formatters::get_response_formatter, options, stats::ResponseStats};
use anyhow::Result;
use pad::{Alignment, PadStr};
use std::fmt::{self, Display};
// Maximum padding for each entry in the final statistics output
const MAX_PADDING: usize = 20;
@ -68,7 +67,7 @@ impl Display for DetailedResponseStats {
let mut sorted_suggestions: Vec<_> = suggestions.iter().collect();
sorted_suggestions.sort_by(|a, b| {
let (a, b) = (a.to_string().to_lowercase(), b.to_string().to_lowercase());
human_sort::compare(&a, &b)
numeric_sort::cmp(&a, &b)
});
writeln!(f, "\nSuggestions in {source}")?;

View file

@ -36,7 +36,7 @@ where
let mut sorted_responses: Vec<&T> = responses.iter().collect();
sorted_responses.sort_by(|a, b| {
let (a, b) = (a.to_string().to_lowercase(), b.to_string().to_lowercase());
human_sort::compare(&a, &b)
numeric_sort::cmp(&a, &b)
});
(source, sorted_responses)
@ -45,7 +45,7 @@ where
entries.sort_by(|(a, _), (b, _)| {
let (a, b) = (a.to_string().to_lowercase(), b.to_string().to_lowercase());
human_sort::compare(&a, &b)
numeric_sort::cmp(&a, &b)
});
entries