Skip to content

Commit

Permalink
bump deps
Browse files Browse the repository at this point in the history
  • Loading branch information
appaquet committed Oct 11, 2023
1 parent 701dfe5 commit 08f6b95
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
5 changes: 1 addition & 4 deletions store/src/local/mutation_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@ impl MutationTracker {
);

for operation_id in operation_ids {
let entry = inner
.operations_requests
.entry(operation_id)
.or_default();
let entry = inner.operations_requests.entry(operation_id).or_default();
entry.insert(request_id);
}
}
Expand Down
2 changes: 1 addition & 1 deletion store/src/local/top_results.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ struct ReserveItem<E, S: Ord> {

impl<E, S: Ord> PartialOrd for ReserveItem<E, S> {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
self.penalized_score.partial_cmp(&other.penalized_score)
Some(self.penalized_score.cmp(&other.penalized_score))
}
}

Expand Down
25 changes: 14 additions & 11 deletions store/src/ordering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,35 @@ pub struct OrderingValueWrapper {

impl PartialOrd for OrderingValueWrapper {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}

impl Ord for OrderingValueWrapper {
fn cmp(&self, other: &Self) -> Ordering {
// an ignored result should be always be less, unless they are both
if self.ignore && other.ignore {
return Some(std::cmp::Ordering::Equal);
return std::cmp::Ordering::Equal;
} else if self.ignore {
return Some(std::cmp::Ordering::Less);
return std::cmp::Ordering::Less;
} else if other.ignore {
return Some(std::cmp::Ordering::Greater);
return std::cmp::Ordering::Greater;
}

let cmp = self.value.partial_cmp(&other.value);
let cmp = self
.value
.partial_cmp(&other.value)
.expect("expected value to be comparable");

// reverse if needed
if self.reverse {
cmp.map(|o| o.reverse())
cmp.reverse()
} else {
cmp
}
}
}

impl Ord for OrderingValueWrapper {
fn cmp(&self, other: &Self) -> Ordering {
self.partial_cmp(other).unwrap()
}
}

impl Eq for OrderingValueWrapper {}

impl OrderingValueWrapper {
Expand Down

0 comments on commit 08f6b95

Please sign in to comment.