diff --git a/provider/adapters/src/fallback/mod.rs b/provider/adapters/src/fallback/mod.rs index c20deb4c460..6034d64b7c3 100644 --- a/provider/adapters/src/fallback/mod.rs +++ b/provider/adapters/src/fallback/mod.rs @@ -44,7 +44,7 @@ use icu_provider::prelude::*; /// langid!("ja").into(), /// ); /// assert_eq!( -/// response.payload.unwrap().get().message, +/// response.payload.get().message, /// "こんにちは世界", /// ); /// ``` diff --git a/provider/adapters/src/fork/predicates.rs b/provider/adapters/src/fork/predicates.rs index 3a710cbb776..9188a575997 100644 --- a/provider/adapters/src/fork/predicates.rs +++ b/provider/adapters/src/fork/predicates.rs @@ -106,7 +106,7 @@ impl ForkByErrorPredicate for MissingDataMarkerPredicate { /// }) /// .expect("Loading should succeed"); /// -/// assert_eq!("Salut, lume", romanian_hello_world.payload..get().message); +/// assert_eq!("Salut, lume", romanian_hello_world.payload.get().message); /// /// // We should not be able to load "en" data because it is not in the provider: /// diff --git a/tutorials/data_provider.md b/tutorials/data_provider.md index c4f819a0635..716fc46de92 100644 --- a/tutorials/data_provider.md +++ b/tutorials/data_provider.md @@ -214,16 +214,14 @@ where #[inline] fn load(&self, req: DataRequest) -> Result, DataError> { let mut res = self.0.load(req)?; - if let Some(mut generic_payload) = res.payload.as_mut() { - // Cast from `DataPayload` to `DataPayload` - let mut any_payload = generic_payload as &mut dyn Any; - if let Some(mut decimal_payload) = any_payload.downcast_mut::>() { - if req.locale.region() == Some(region!("CH")) { - decimal_payload.with_mut(|data| { - // Change the grouping separator for all Swiss locales to '🐮' - data.grouping_separator = Cow::Borrowed("🐮"); - }); - } + // Cast from `DataPayload` to `DataPayload` + let mut any_payload = (&mut res.payload) as &mut dyn Any; + if let Some(mut decimal_payload) = any_payload.downcast_mut::>() { + if req.locale.region() == Some(region!("CH")) { + decimal_payload.with_mut(|data| { + // Change the grouping separator for all Swiss locales to '🐮' + data.grouping_separator = Cow::Borrowed("🐮"); + }); } } Ok(res)