Skip to content

Commit

Permalink
Fix deprecation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
OJFord committed Jan 29, 2024
1 parent 919b14e commit 6d2b318
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
12 changes: 4 additions & 8 deletions notmuch-more/src/compose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use std::convert::TryInto;
use std::fs;

use anyhow::anyhow;
use chrono::DateTime;
use base64::{engine::general_purpose::STANDARD as BASE64_STANDARD, Engine as _};
use chrono::Local;
use chrono::NaiveDateTime;
use chrono::TimeZone;
use chrono::Utc;
use itertools::Itertools;
use notmuch::Database;
Expand Down Expand Up @@ -84,7 +84,7 @@ pub fn format_message(
.essence_str(),
"base64",
&format!("attachment; filename={}", attachment.name),
&format_attachment(&base64::encode(fs::read(&attachment.path)?)),
&format_attachment(&BASE64_STANDARD.encode(&fs::read(&attachment.path)?)),
));
}

Expand All @@ -94,11 +94,7 @@ pub fn format_message(
fn template_body(meta: &EmlMeta, body: &EmlBody) -> String {
format!(
"\r\n\r\nOn {}, {} wrote:\r\n{}",
DateTime::<Utc>::from_utc(
NaiveDateTime::from_timestamp_opt(meta.timestamp, 0).unwrap(),
Utc
)
.to_rfc2822(),
Utc.timestamp_opt(meta.timestamp, 0).unwrap().to_rfc2822(),
meta.from
.last()
.map(String::from)
Expand Down
7 changes: 2 additions & 5 deletions notmuch-more/src/parse/headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::convert::TryInto;

use chrono::DateTime;
use chrono::FixedOffset;
use chrono::NaiveDateTime;
use chrono::TimeZone;
use chrono::Utc;
use delegate::delegate;
use itertools::Itertools;
Expand Down Expand Up @@ -362,10 +362,7 @@ impl From<&EmlMeta> for Rfc5322Fields {
}
}));

fields.date(&DateTime::<Utc>::from_utc(
NaiveDateTime::from_timestamp_opt(meta.timestamp, 0).unwrap(),
Utc,
));
fields.date(&Utc.timestamp_opt(meta.timestamp, 0).unwrap());

fields
}
Expand Down

0 comments on commit 6d2b318

Please sign in to comment.