From 12d6ed4aac18d22385ceb216ad4c94f6a0cd911a Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Thu, 3 Oct 2019 12:41:35 +0300 Subject: Change: simplify get_name implemention, more idiotmatic --- src/roadmap.rs | 7 +------ 1 file changed, 1 insertion(+), 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 -- cgit v1.2.1