Skip to content

Commit 8126627

Browse files
committed
fix warning
1 parent 6abb3f6 commit 8126627

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

cosmogony/src/mutable_slice.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@ impl<'a> MutableSlice<'a> {
2424

2525
pub fn get(&self, zindex: &ZoneIndex) -> &Zone {
2626
let idx = zindex.index;
27-
if idx < self.idx {
28-
&self.left[idx]
29-
} else if idx == self.idx {
30-
panic!("Cannot retrieve middle index");
31-
} else {
32-
&self.right[idx - self.idx - 1]
27+
match idx {
28+
i if i < self.idx => &self.left[i],
29+
i if i == self.idx => panic!("Cannot retrieve middle index"),
30+
i => &self.right[i - self.idx - 1],
3331
}
3432
}
3533
}

cosmogony/src/zone.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,13 @@ where
271271
D: serde::Deserializer<'de>,
272272
{
273273
use serde::Deserialize;
274-
Option::<Vec<f64>>::deserialize(d).map(|option| match option {
275-
Some(b) => Some(Rect::new(
276-
geo_types::Coord { x: b[0], y: b[1] }, // min
277-
geo_types::Coord { x: b[2], y: b[3] }, // max
278-
)),
279-
None => None,
274+
Option::<Vec<f64>>::deserialize(d).map(|option| {
275+
option.map(|b| {
276+
Rect::new(
277+
geo_types::Coord { x: b[0], y: b[1] }, // min
278+
geo_types::Coord { x: b[2], y: b[3] }, // max
279+
)
280+
})
280281
})
281282
}
282283

0 commit comments

Comments
 (0)