diff --git a/src/naive/datetime/mod.rs b/src/naive/datetime/mod.rs index 34c5e0c900..7da7820501 100644 --- a/src/naive/datetime/mod.rs +++ b/src/naive/datetime/mod.rs @@ -902,6 +902,8 @@ impl NaiveDateTime { /// let tz = FixedOffset::east_opt(5 * hour).unwrap(); /// let dt = NaiveDate::from_ymd_opt(2015, 9, 5).unwrap().and_hms_opt(23, 56, 4).unwrap().and_local_timezone(tz).unwrap(); /// assert_eq!(dt.timezone(), tz); + /// ``` + #[must_use] pub fn and_local_timezone(&self, tz: Tz) -> LocalResult> { tz.from_local_datetime(self) } @@ -914,6 +916,8 @@ impl NaiveDateTime { /// use chrono::{NaiveDate, NaiveTime, Utc}; /// let dt = NaiveDate::from_ymd_opt(2023, 1, 30).unwrap().and_hms_opt(19, 32, 33).unwrap().and_utc_timezone(); /// assert_eq!(dt.timezone(), Utc); + /// ``` + #[must_use] pub fn and_utc_timezone(&self) -> DateTime { Utc.from_utc_datetime(self) }