File tree Expand file tree Collapse file tree 2 files changed +11
-12
lines changed Expand file tree Collapse file tree 2 files changed +11
-12
lines changed Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments