Skip to content

Commit 1975e76

Browse files
committed
Replace calls to deprecated functions with a recommended replacements
1 parent 886878e commit 1975e76

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ fn rfc2822<T: AsRef<str>>(string: T) -> Option<DateTime<FixedOffset>> {
5454

5555
fn utc_datetime(string: &str, format: &str) -> Option<DateTime<FixedOffset>> {
5656
NaiveDateTime::parse_from_str(string, format)
57-
.map(|d| DateTime::from_utc(d, Utc))
57+
.map(|d| Utc.from_utc_datetime(&d))
5858
.ok()
5959
.map(|d: DateTime<Utc>| d.into())
6060
}
@@ -63,7 +63,7 @@ fn utc_date(string: &str, format: &str) -> Option<DateTime<FixedOffset>> {
6363
let date = NaiveDate::parse_from_str(string, format).ok()?;
6464
let time = NaiveTime::from_hms_opt(0, 0, 0)?;
6565
let datetime = NaiveDateTime::new(date, time);
66-
Some(DateTime::<Utc>::from_utc(datetime, Utc).into())
66+
Some(Utc.from_utc_datetime(&datetime).into())
6767
}
6868

6969
/// Parses a string using multiple formats

0 commit comments

Comments
 (0)