Skip to content

Commit fda78d1

Browse files
committed
Work around Rust bug rust-lang/rust#93470
1 parent edd600e commit fda78d1

File tree

1 file changed

+12
-8
lines changed
  • provider/cldr/src/transform/time_zones

1 file changed

+12
-8
lines changed

provider/cldr/src/transform/time_zones/mod.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,18 @@ impl TryFrom<&str> for TimeZonesProvider {
6868
impl KeyedDataProvider for TimeZonesProvider {
6969
fn supports_key(resc_key: &ResourceKey) -> Result<(), DataError> {
7070
// TODO(#442): Clean up KeyedDataProvider
71-
match *resc_key {
72-
key::TIMEZONE_FORMATS_V1 => Ok(()),
73-
key::TIMEZONE_EXEMPLAR_CITIES_V1 => Ok(()),
74-
key::TIMEZONE_GENERIC_NAMES_LONG_V1 => Ok(()),
75-
key::TIMEZONE_GENERIC_NAMES_SHORT_V1 => Ok(()),
76-
key::TIMEZONE_SPECIFIC_NAMES_LONG_V1 => Ok(()),
77-
key::TIMEZONE_SPECIFIC_NAMES_SHORT_V1 => Ok(()),
78-
_ => Err(DataErrorKind::MissingResourceKey.with_key(*resc_key)),
71+
// Note: This is a big if{} instead of match{} due to Rust bug #93470
72+
if *resc_key == key::TIMEZONE_FORMATS_V1
73+
|| *resc_key == key::TIMEZONE_FORMATS_V1
74+
|| *resc_key == key::TIMEZONE_EXEMPLAR_CITIES_V1
75+
|| *resc_key == key::TIMEZONE_GENERIC_NAMES_LONG_V1
76+
|| *resc_key == key::TIMEZONE_GENERIC_NAMES_SHORT_V1
77+
|| *resc_key == key::TIMEZONE_SPECIFIC_NAMES_LONG_V1
78+
|| *resc_key == key::TIMEZONE_SPECIFIC_NAMES_SHORT_V1
79+
{
80+
Ok(())
81+
} else {
82+
Err(DataErrorKind::MissingResourceKey.with_key(*resc_key))
7983
}
8084
}
8185
}

0 commit comments

Comments
 (0)