code: Use chained if-let's

This commit is contained in:
Sophie Herold 2026-01-29 19:04:26 +01:00
parent f806bbd484
commit 8972c5efb9
12 changed files with 219 additions and 235 deletions

View file

@ -369,12 +369,11 @@ impl Metadata {
let location_exact = libgweather::Location::new_detached("", None, lat, lon);
// do not use city if more than 15 km away
if nearest_city.distance(&location_exact) < 15. {
if let (Some(city), Some(country)) =
if nearest_city.distance(&location_exact) < 15.
&& let (Some(city), Some(country)) =
(nearest_city.city_name(), nearest_city.country_name())
{
return Some(format!("{city}, {country}"));
}
{
return Some(format!("{city}, {country}"));
}
}