From b4a1ab77998e411d0159198698f8dcb36365247e Mon Sep 17 00:00:00 2001 From: Kurtis Nusbaum Date: Sun, 9 Apr 2023 20:32:30 +0000 Subject: [PATCH] fix docstring tests and add must_use attribute --- src/naive/datetime/mod.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/naive/datetime/mod.rs b/src/naive/datetime/mod.rs index 670a0cb5f5..46666a30fd 100644 --- a/src/naive/datetime/mod.rs +++ b/src/naive/datetime/mod.rs @@ -944,6 +944,7 @@ 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) @@ -957,6 +958,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) }