Skip to content

Commit f1553f4

Browse files
committed
fix: sort_worker_results error handling cases
1 parent ab55454 commit f1553f4

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

src/walk.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -676,15 +676,20 @@ impl WorkerState {
676676

677677
fn sort_worker_results(results: &mut [WorkerResult], sort_key: SortKey) {
678678
results.sort_by(|a, b| {
679-
// Errors sort to the end; two errors are considered equal
679+
// Errors sort to the end; two errors are considered equal.
680680
let (a, b) = match (a, b) {
681-
(WorkerResult::Entry(a), WorkerResult::Entry(b)) => (a, b)
682-
(WorkerResult::Error(_), WorkerResult::Entry(_)) => return std::cmp::Ordering::Greater,
683-
(WorkerResult::Entry(_), WorkerResult::Error(_)) => return std::cmp::Ordering::Less,
684-
_ => return std::cmp::Ordering::Equal,
681+
(WorkerResult::Entry(a), WorkerResult::Entry(b)) => (a, b),
682+
(WorkerResult::Error(_), WorkerResult::Entry(_)) => {
683+
return std::cmp::Ordering::Greater;
684+
}
685+
(WorkerResult::Entry(_), WorkerResult::Error(_)) => {
686+
return std::cmp::Ordering::Less;
687+
}
688+
(WorkerResult::Error(_), WorkerResult::Error(_)) => {
689+
return std::cmp::Ordering::Equal;
690+
}
685691
};
686692

687-
688693
match sort_key {
689694
SortKey::Path => a.path().cmp(b.path()),
690695
SortKey::Size => {

0 commit comments

Comments
 (0)