remove repeated choice from "speed". use nicer method

This commit is contained in:
Michael Kirk 2021-04-22 10:39:35 -07:00 committed by Dustin Carlino
parent 8722c102b9
commit e8e678f4ca
2 changed files with 2 additions and 2 deletions

View File

@ -737,7 +737,7 @@ pub fn speed_limit_choices(app: &App, preset: Option<Speed>) -> Vec<Choice<Speed
.map(|mph| Speed::miles_per_hour(mph as f64))
.collect::<Vec<_>>();
if let Some(preset) = preset {
if !speeds.iter().all(|x| *x == preset) {
if !speeds.contains(&preset) {
speeds.push(preset);
speeds.sort();
}

View File

@ -457,7 +457,7 @@ fn width_choices(app: &App, l: LaneID) -> Vec<Choice<Distance>> {
Distance::meters(3.0),
];
let current_width = app.primary.map.get_l(l).width;
if choices.iter().all(|x| *x != current_width) {
if !choices.contains(&current_width) {
choices.push(current_width);
choices.sort();
}