Skip to content

Commit

Permalink
Update dependencies (#386)
Browse files Browse the repository at this point in the history
Update dependencies and set MSRV to 1.40
  • Loading branch information
amousset committed Dec 23, 2019
1 parent 3995ea2 commit 245c600
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 21 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
rust:
- stable
- beta
- 1.36.0
- 1.40.0
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
Expand All @@ -38,7 +38,7 @@ jobs:
rust:
- stable
- beta
- 1.36.0
- 1.40.0
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
Expand All @@ -63,8 +63,17 @@ jobs:
clippy:
name: Clippy
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- beta
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- uses: actions-rs/cargo@v1
with:
command: clippy
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ base64 = { version = "^0.11", optional = true }
bufstream = { version = "^0.1", optional = true }
email = { version = "^0.0.20", optional = true }
fast_chemail = "^0.9"
hostname = { version = "^0.2", optional = true }
hostname = { version = "^0.3", optional = true }
log = "^0.4"
mime = { version = "^0.3", optional = true }
native-tls = { version = "^0.2", optional = true }
Expand All @@ -30,7 +30,7 @@ r2d2 = { version = "^0.8", optional = true }
rustls = { version = "^0.16", optional = true }
serde = { version = "^1.0", optional = true, features = ["derive"] }
serde_json = { version = "^1.0", optional = true }
time = { version = "^0.1", optional = true }
time = { version = "^0.2", optional = true }
uuid = { version = "^0.8", features = ["v4"], optional = true }
webpki = { version = "^0.21", optional = true }

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

[![Crate](https://img.shields.io/crates/v/lettre.svg)](https://crates.io/crates/lettre)
[![Docs](https://docs.rs/lettre/badge.svg)](https://docs.rs/lettre/)
[![Required Rust version](https://img.shields.io/badge/rustc-1.36-green.svg)]()
[![Required Rust version](https://img.shields.io/badge/rustc-1.40-green.svg)]()
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)

[![Gitter](https://badges.gitter.im/lettre/lettre.svg)](https://gitter.im/lettre/lettre?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
Expand All @@ -33,7 +33,7 @@ Lettre provides the following features:

## Example

This library requires Rust 1.36 or newer.
This library requires Rust 1.40 or newer.
To use this library, add the following to your `Cargo.toml`:

```toml
Expand Down
30 changes: 16 additions & 14 deletions src/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ use std::fmt;
use std::fs;
use std::path::Path;
use std::str::FromStr;
use time::{now, Tm};
use time::OffsetDateTime;
use uuid::Uuid;

pub mod error;

const DT_RFC822Z: &str = "%a, %d %b %Y %T %z";

// From rust-email, allows adding rfc2047 encoding

/// Represents an RFC 5322 mailbox
Expand Down Expand Up @@ -280,8 +282,8 @@ impl EmailBuilder {
}

/// Adds a `Date` header with the given date
pub fn date(mut self, date: &Tm) -> EmailBuilder {
self.message = self.message.header(("Date", Tm::rfc822z(date).to_string()));
pub fn date(mut self, date: &OffsetDateTime) -> EmailBuilder {
self.message = self.message.header(("Date", date.format(DT_RFC822Z)));
self.date_issued = true;
self
}
Expand Down Expand Up @@ -508,7 +510,7 @@ impl EmailBuilder {
if !self.date_issued {
self.message = self
.message
.header(("Date", Tm::rfc822z(&now()).to_string()));
.header(("Date", OffsetDateTime::now().format(DT_RFC822Z)));
}

self.message = self.message.header(("MIME-Version", "1.0"));
Expand Down Expand Up @@ -536,7 +538,7 @@ impl EmailBuilder {
mod test {
use super::*;
use crate::EmailAddress;
use time::now;
use time::OffsetDateTime;

#[test]
fn test_encode_rfc2047() {
Expand All @@ -553,7 +555,7 @@ mod test {
#[test]
fn test_multiple_from() {
let email_builder = EmailBuilder::new();
let date_now = now();
let date_now = OffsetDateTime::now();
let email: Email = email_builder
.to("anna@example.com")
.from("dieter@example.com")
Expand All @@ -572,7 +574,7 @@ mod test {
<dieter@example.com>\r\nTo: <anna@example.com>\r\nFrom: \
<dieter@example.com>, <joachim@example.com>\r\nMIME-Version: \
1.0\r\nMessage-ID: <{}.lettre@localhost>\r\n\r\nWe invite you!\r\n",
date_now.rfc822z(),
date_now.format(DT_RFC822Z),
id
)
);
Expand All @@ -581,7 +583,7 @@ mod test {
#[test]
fn test_email_builder() {
let email_builder = EmailBuilder::new();
let date_now = now();
let date_now = OffsetDateTime::now();

let email: Email = email_builder
.to("user@localhost")
Expand Down Expand Up @@ -609,7 +611,7 @@ mod test {
Reply-To: <reply@localhost>\r\nIn-Reply-To: original\r\n\
MIME-Version: 1.0\r\nMessage-ID: \
<{}.lettre@localhost>\r\n\r\nHello World!\r\n",
date_now.rfc822z(),
date_now.format(DT_RFC822Z),
id
)
);
Expand All @@ -618,7 +620,7 @@ mod test {
#[test]
fn test_custom_message_id() {
let email_builder = EmailBuilder::new();
let date_now = now();
let date_now = OffsetDateTime::now();

let email: Email = email_builder
.to("user@localhost")
Expand All @@ -644,14 +646,14 @@ mod test {
<user@localhost>\r\nCc: \"Alias\" <cc@localhost>\r\nReply-To: \
<reply@localhost>\r\nIn-Reply-To: original\r\nMIME-Version: 1.0\r\n\r\nHello \
World!\r\n",
date_now.rfc822z()
date_now.format(DT_RFC822Z)
)
);
}

#[test]
fn test_email_builder_body() {
let date_now = now();
let date_now = OffsetDateTime::now();
let email_builder = EmailBuilder::new()
.text("TestTest")
.subject("A Subject")
Expand All @@ -663,7 +665,7 @@ mod test {

#[test]
fn test_email_subject_encoding() {
let date_now = now();
let date_now = OffsetDateTime::now();
let email_builder = EmailBuilder::new()
.text("TestTest")
.subject("A ö Subject")
Expand All @@ -678,7 +680,7 @@ mod test {
#[test]
fn test_email_sendable() {
let email_builder = EmailBuilder::new();
let date_now = now();
let date_now = OffsetDateTime::now();

let email: Email = email_builder
.to("user@localhost")
Expand Down
2 changes: 1 addition & 1 deletion website/src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Lettre is an email library that allows creating and sending messages. It provide
* Unicode support (for emails and transports, including for sender et recipient addresses when compatible)
* Secure defaults (emails are only sent encrypted by default)

Lettre requires Rust 1.36 or newer. Add the following to your `Cargo.toml`:
Lettre requires Rust 1.40 or newer. Add the following to your `Cargo.toml`:

```toml
[dependencies]
Expand Down

0 comments on commit 245c600

Please sign in to comment.