Skip to content

Commit 56f6717

Browse files
committed
Simplify nested if
1 parent b60652d commit 56f6717

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

src/lib.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,18 @@ macro_rules! base_main {
9090
.into_iter()
9191
.filter(|day| days.contains(&format!("day{}", day).as_str()))
9292
.collect()
93+
} else if opt.is_present("all") {
94+
parse!(extract_day {}; $( $tail )*)
95+
.iter()
96+
.map(|s| &s[3..])
97+
.collect()
9398
} else {
94-
if opt.is_present("all") {
95-
parse!(extract_day {}; $( $tail )*)
96-
.iter()
97-
.map(|s| &s[3..])
98-
.collect()
99-
} else {
100-
vec![parse!(extract_day {}; $( $tail )*)
101-
.iter()
102-
.map(|s| &s[3..])
103-
.last()
104-
.expect("No day implemenations found")]
105-
}
99+
// Get most recent day, assuming the days are sorted
100+
vec![parse!(extract_day {}; $( $tail )*)
101+
.iter()
102+
.map(|s| &s[3..])
103+
.last()
104+
.expect("No day implemenations found")]
106105
}
107106
};
108107

0 commit comments

Comments
 (0)