Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lychee-bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
4 changes: 3 additions & 1 deletion lychee-bin/src/formatters/stats/compact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ use crate::{formatters::get_response_formatter, options, stats::ResponseStats};

use super::StatsFormatter;

use numeric_sort::cmp;

struct CompactResponseStats {
stats: ResponseStats,
mode: options::OutputMode,
Expand Down Expand Up @@ -52,7 +54,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)
cmp(&a, &b)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is std::cmp. Can we use the fully qualified name here to avoid the naming confusion?

Suggested change
cmp(&a, &b)
numeric_sort::cmp(&a, &b)

});

writeln!(f, "\n\u{2139} Suggestions")?;
Expand Down
4 changes: 2 additions & 2 deletions lychee-bin/src/formatters/stats/detailed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use super::StatsFormatter;
use crate::{formatters::get_response_formatter, options, stats::ResponseStats};

use anyhow::Result;
use numeric_sort::cmp;
use pad::{Alignment, PadStr};
use std::fmt::{self, Display};

// Maximum padding for each entry in the final statistics output
const MAX_PADDING: usize = 20;

Expand Down Expand Up @@ -68,7 +68,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)
cmp(&a, &b)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here and in the other examples

});

writeln!(f, "\nSuggestions in {source}")?;
Expand Down
6 changes: 4 additions & 2 deletions lychee-bin/src/formatters/stats/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ use crate::stats::ResponseStats;
use anyhow::Result;
use lychee_lib::InputSource;

use numeric_sort::cmp;

pub(crate) trait StatsFormatter {
/// Format the stats of all responses and write them to stdout
fn format(&self, stats: ResponseStats) -> Result<Option<String>>;
Expand All @@ -36,7 +38,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)
cmp(&a, &b)
});

(source, sorted_responses)
Expand All @@ -45,7 +47,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)
cmp(&a, &b)
});

entries
Expand Down