File tree Expand file tree Collapse file tree 2 files changed +5
-11
lines changed Expand file tree Collapse file tree 2 files changed +5
-11
lines changed Original file line number Diff line number Diff line change @@ -93,7 +93,10 @@ impl<Tz: TimeZone> DateTime<Tz> {
93
93
/// ```
94
94
#[ inline]
95
95
#[ must_use]
96
- pub fn from_naive_utc_and_offset ( datetime : NaiveDateTime , offset : Tz :: Offset ) -> DateTime < Tz > {
96
+ pub const fn from_naive_utc_and_offset (
97
+ datetime : NaiveDateTime ,
98
+ offset : Tz :: Offset ,
99
+ ) -> DateTime < Tz > {
97
100
DateTime { datetime, offset }
98
101
}
99
102
@@ -655,14 +658,6 @@ impl DateTime<Utc> {
655
658
NaiveDateTime :: from_timestamp_millis ( millis) . as_ref ( ) . map ( NaiveDateTime :: and_utc)
656
659
}
657
660
658
- // FIXME: remove when our MSRV is 1.61+
659
- // This method is used by `NaiveDateTime::and_utc` because `DateTime::from_naive_utc_and_offset`
660
- // can't be made const yet.
661
- // Trait bounds in const function / implementation blocks were not supported until 1.61.
662
- pub ( crate ) const fn from_naive_utc ( datetime : NaiveDateTime ) -> Self {
663
- DateTime { datetime, offset : Utc }
664
- }
665
-
666
661
/// The Unix Epoch, 1970-01-01 00:00:00 UTC.
667
662
pub const UNIX_EPOCH : Self = Self { datetime : NaiveDateTime :: UNIX_EPOCH , offset : Utc } ;
668
663
}
Original file line number Diff line number Diff line change @@ -1066,8 +1066,7 @@ impl NaiveDateTime {
1066
1066
/// ```
1067
1067
#[ must_use]
1068
1068
pub const fn and_utc ( & self ) -> DateTime < Utc > {
1069
- // FIXME: use `DateTime::from_naive_utc_and_offset` when our MSRV is 1.61+.
1070
- DateTime :: from_naive_utc ( * self )
1069
+ DateTime :: from_naive_utc_and_offset ( * self , Utc )
1071
1070
}
1072
1071
1073
1072
/// The minimum possible `NaiveDateTime`.
You can’t perform that action at this time.
0 commit comments