Skip to content

Commit

Permalink
Refactor a complex stopwatch model iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
ndebuhr committed Nov 8, 2021
1 parent 0e62d32 commit c8a4aed
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions sim/src/models/stopwatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,11 @@ impl Stopwatch {
}

fn matching_or_new_job(&mut self, incoming_message: &ModelMessage) -> &mut Job {
if self
if !self
.state
.jobs
.iter()
.find(|job| job.name == incoming_message.content)
.is_none()
.any(|job| job.name == incoming_message.content)
{
self.state.jobs.push(Job {
name: incoming_message.content.clone(),
Expand Down

0 comments on commit c8a4aed

Please sign in to comment.