@@ -26,15 +26,6 @@ pub enum BooleanOperationError {
26
26
Unexpected , // For debugging, when complete nothing should be unexpected
27
27
}
28
28
29
- /// A simple and idiomatic way to write short "if let Some(_)" statements which do nothing in the None case
30
- macro_rules! do_if {
31
- ( $option: expr, $name: ident{ $todo: expr} ) => {
32
- if let Some ( $name) = $option {
33
- $todo
34
- }
35
- } ;
36
- }
37
-
38
29
struct Edge {
39
30
pub from : Origin ,
40
31
pub destination : usize ,
@@ -219,19 +210,19 @@ impl PathGraph {
219
210
for ( vertex_id, sub_seg) in vertex_ids. into_iter ( ) . zip ( subdivided. iter ( ) ) {
220
211
match self . current_start {
221
212
Some ( index) => {
222
- do_if ! ( sub_seg, end_of_edge { self . current. push( * end_of_edge) } ) ;
213
+ sub_seg. map ( | end_of_edge| self . current . push ( end_of_edge) ) ;
223
214
graph. add_edge ( origin, index, vertex_id, self . current . clone ( ) ) ;
224
215
self . current_start = Some ( vertex_id) ;
225
216
self . current = Vec :: new ( ) ;
226
217
}
227
218
None => {
228
219
self . current_start = Some ( vertex_id) ;
229
220
self . start_index = Some ( vertex_id) ;
230
- do_if ! ( sub_seg, end_of_beginning { self . beginning. push( * end_of_beginning) } ) ;
221
+ sub_seg. map ( | end_of_beginning| self . beginning . push ( end_of_beginning) ) ;
231
222
}
232
223
}
233
224
}
234
- do_if ! ( subdivided. last( ) . unwrap( ) , start_of_edge { self . current. push( * start_of_edge) } ) ;
225
+ subdivided. last ( ) . unwrap ( ) . map ( | start_of_edge| self . current . push ( start_of_edge) ) ;
235
226
} else {
236
227
match self . current_start {
237
228
Some ( _) => self . current . push ( seg) ,
0 commit comments