summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2019-10-03 12:41:35 +0300
committerLars Wirzenius <liw@liw.fi>2019-10-03 12:41:35 +0300
commit12d6ed4aac18d22385ceb216ad4c94f6a0cd911a (patch)
tree7afde24006fb9636b7f7221e77f7b743c70228ba
parent65a1a8ad92f886975f1eedf05cd690368b2fdf8e (diff)
downloadroadmap-12d6ed4aac18d22385ceb216ad4c94f6a0cd911a.tar.gz
Change: simplify get_name implemention, more idiotmatic
-rw-r--r--src/roadmap.rs7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/roadmap.rs b/src/roadmap.rs
index 7924874..8f2fb9d 100644
--- a/src/roadmap.rs
+++ b/src/roadmap.rs
@@ -31,12 +31,7 @@ impl Roadmap {
/// Get a step, given its name.
pub fn get_step<'a>(&'a self, name: &str) -> Option<&'a Step> {
- for step in self.steps.iter() {
- if step.name() == name {
- return Some(step);
- }
- }
- None
+ self.steps.iter().filter(|step| step.name() == name).next()
}
/// Add a step to the roadmap. This may fail, if there's a step