significant code simplification proposed by zesterer

This commit is contained in:
Christof Petig 2023-03-17 22:43:19 +01:00
parent b555d619fb
commit 0e73bd23ed

View File

@ -872,22 +872,8 @@ impl SpotCondition {
SpotCondition::IsUnderwater.is_valid(g, c) && c.water_alt > c.alt + depth
},
SpotCondition::Not(condition) => !condition.is_valid(g, c),
SpotCondition::All(conditions) => 'outer: {
for cond in conditions.iter() {
if !cond.is_valid(g, c) {
break 'outer false;
}
}
true
},
SpotCondition::Any(conditions) => 'outer: {
for cond in conditions.iter() {
if cond.is_valid(g, c) {
break 'outer true;
}
}
false
},
SpotCondition::All(conditions) => conditions.iter().all(|cond| cond.is_valid(g, c)),
SpotCondition::Any(conditions) => conditions.iter().any(|cond| cond.is_valid(g, c)),
}
}
}