Skip to content

Commit ec5f67d

Browse files
committed
Removed do_if!
1 parent 80d9926 commit ec5f67d

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

graphene/src/boolean_ops.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,6 @@ pub enum BooleanOperationError {
2626
Unexpected, // For debugging, when complete nothing should be unexpected
2727
}
2828

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-
3829
struct Edge {
3930
pub from: Origin,
4031
pub destination: usize,
@@ -219,19 +210,19 @@ impl PathGraph {
219210
for (vertex_id, sub_seg) in vertex_ids.into_iter().zip(subdivided.iter()) {
220211
match self.current_start {
221212
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));
223214
graph.add_edge(origin, index, vertex_id, self.current.clone());
224215
self.current_start = Some(vertex_id);
225216
self.current = Vec::new();
226217
}
227218
None => {
228219
self.current_start = Some(vertex_id);
229220
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));
231222
}
232223
}
233224
}
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));
235226
} else {
236227
match self.current_start {
237228
Some(_) => self.current.push(seg),

0 commit comments

Comments
 (0)