Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 1 addition & 2 deletions crates/cli/src/utils/suggestions.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//! Helper functions for suggesting alternative values for a possibly erroneous user input.
use std::cmp::Ordering;

/// Filters multiple strings from a given list of possible values which are similar
/// to the passed in value `v` within a certain confidence by least confidence.
Expand All @@ -17,7 +16,7 @@ where
.map(|pv| (strsim::jaro_winkler(v, pv.as_ref()), pv.as_ref().to_owned()))
.filter(|(similarity, _)| *similarity > 0.8)
.collect();
candidates.sort_by(|a, b| a.0.partial_cmp(&b.0).unwrap_or(Ordering::Equal));
candidates.sort_by(|a, b| a.0.total_cmp(&b.0));
candidates.into_iter().map(|(_, pv)| pv).collect()
}

Expand Down
2 changes: 1 addition & 1 deletion crates/common/src/contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ impl ContractsByArtifact {
None
}
})
.min_by(|(score1, _), (score2, _)| score1.partial_cmp(score2).unwrap())
.min_by(|(score1, _), (score2, _)| score1.total_cmp(score2))
.map(|(_, data)| data)
}

Expand Down
6 changes: 2 additions & 4 deletions crates/forge/bin/cmd/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,7 @@ fn diff(tests: Vec<SuiteTestResult>, snaps: Vec<GasSnapshotEntry>) -> Result<()>
let mut overall_gas_change = 0i128;
let mut overall_gas_used = 0i128;

diffs.sort_by(|a, b| {
a.gas_diff().abs().partial_cmp(&b.gas_diff().abs()).unwrap_or(Ordering::Equal)
});
diffs.sort_by(|a, b| a.gas_diff().abs().total_cmp(&b.gas_diff().abs()));

for diff in diffs {
let gas_change = diff.gas_change();
Expand All @@ -401,7 +399,7 @@ fn diff(tests: Vec<SuiteTestResult>, snaps: Vec<GasSnapshotEntry>) -> Result<()>

fn fmt_pct_change(change: f64) -> String {
let change_pct = change * 100.0;
match change.partial_cmp(&0.0).unwrap_or(Ordering::Equal) {
match change.total_cmp(&0.0) {
Ordering::Less => format!("{change_pct:.3}%").green().to_string(),
Ordering::Equal => {
format!("{change_pct:.3}%")
Expand Down