upgrade to rust 1.42 for better unwrap() errors and use of matches!

This commit is contained in:
Dustin Carlino 2020-03-12 12:55:48 -07:00
parent 6e8846bf85
commit 78407dd529
4 changed files with 5 additions and 18 deletions

View File

@ -5,7 +5,7 @@
You will first need:
- Standard dependencies: `bash`, `curl`, `unzip`, `gunzip`
- Rust, at least 1.41. https://www.rust-lang.org/tools/install
- Rust, at least 1.42. https://www.rust-lang.org/tools/install
One-time setup:

View File

@ -1007,10 +1007,7 @@ impl DrivingSimState {
if intersections
.get_accepted_agents(i)
.iter()
.any(|a| match a {
AgentID::Car(_) => true,
_ => false,
})
.any(|a| matches!(a, AgentID::Car(_)))
{
return format!("someone's turning in {} still", i);
}

View File

@ -570,14 +570,8 @@ impl Pedestrian {
PedState::WaitingToTurn(_, _) => Some(self.path.next_step().as_turn()),
_ => None,
},
preparing_bike: match self.state {
PedState::StartingToBike(_, _, _) | PedState::FinishingBiking(_, _, _) => true,
_ => false,
},
waiting_for_bus: match self.state {
PedState::WaitingForBus(_, _) => true,
_ => false,
},
preparing_bike: matches!(self.state, PedState::StartingToBike(_, _, _) | PedState::FinishingBiking(_, _, _)),
waiting_for_bus: matches!(self.state, PedState::WaitingForBus(_, _)),
on,
metadata: self.metadata(now),
}

View File

@ -613,11 +613,7 @@ impl Trip {
}
fn is_bus_trip(&self) -> bool {
self.legs.len() == 1
&& match self.legs[0] {
TripLeg::ServeBusRoute(_, _) => true,
_ => false,
}
self.legs.len() == 1 && matches!(self.legs[0], TripLeg::ServeBusRoute(_, _))
}
// Returns true if this succeeds. If not, trip aborted.