Skip to content

Commit 465920b

Browse files
committed
Missing data: refactor min/max pattern matching to avoid unwrap
1 parent 7118e77 commit 465920b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/operations.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl NumOperation for Max {
100100
.fold((None, 0), |(a, count), b| {
101101
let max = match (a, b) {
102102
(None, b) => Some(b), //FIXME: if b.is_finite() { Some(b) } else { None },
103-
(a, b) => Some(std::cmp::max_by(a.unwrap(), b, |x, y| {
103+
(Some(a), b) => Some(std::cmp::max_by(a, b, |x, y| {
104104
x.partial_cmp(y).unwrap_or(std::cmp::Ordering::Greater)
105105
})),
106106
};
@@ -153,7 +153,7 @@ impl NumOperation for Min {
153153
.fold((None, 0), |(a, count), b| {
154154
let min = match (a, b) {
155155
(None, b) => Some(b), //FIXME: if b.is_finite() { Some(b) } else { None },
156-
(a, b) => Some(std::cmp::min_by(a.unwrap(), b, |x, y| {
156+
(Some(a), b) => Some(std::cmp::min_by(a, b, |x, y| {
157157
x.partial_cmp(y).unwrap_or(std::cmp::Ordering::Less)
158158
})),
159159
};

0 commit comments

Comments
 (0)