Skip to content

Commit

Permalink
Address clippy complaint about single match arm
Browse files Browse the repository at this point in the history
I expect more arms to be added here later, but for the time being, let's
address the clippy complaint and swap this to an if let. It would be
nice if we could chain these ifs, it's not stabilized yet:
rust-lang/rust#53667
  • Loading branch information
jmqd committed Mar 22, 2024
1 parent c653aeb commit f389a84
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,10 @@ impl Simulation {
/// An internal function used to wakeup sleeping Agents due to wake.
fn wakeup_agents_scheduled_to_wakeup_now(&mut self) {
for agent in self.agents.iter_mut() {
match agent.state {
AgentState::AsleepUntil(scheduled_wakeup) => {
if self.time >= scheduled_wakeup {
agent.state = AgentState::Active;
}
if let AgentState::AsleepUntil(scheduled_wakeup) = agent.state {
if self.time >= scheduled_wakeup {
agent.state = AgentState::Active;
}
_ => (),
}
}
}
Expand Down

0 comments on commit f389a84

Please sign in to comment.