Bump our MSRV to 1.45.2
This commit is contained in:
5
.github/workflows/test.yml
vendored
5
.github/workflows/test.yml
vendored
@@ -11,7 +11,7 @@ jobs:
|
||||
rust:
|
||||
- stable
|
||||
- beta
|
||||
- 1.40.0
|
||||
- 1.45.2
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: actions-rs/toolchain@v1
|
||||
@@ -37,7 +37,6 @@ jobs:
|
||||
args: --no-default-features --features=builder,smtp-transport,file-transport,sendmail-transport
|
||||
- run: rm target/debug/deps/liblettre-*
|
||||
- uses: actions-rs/cargo@v1
|
||||
if: matrix.rust != '1.40.0'
|
||||
with:
|
||||
command: test
|
||||
args: --features=async-std1
|
||||
@@ -54,7 +53,7 @@ jobs:
|
||||
rust:
|
||||
- stable
|
||||
- beta
|
||||
- 1.40.0
|
||||
- 1.45.2
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: actions-rs/toolchain@v1
|
||||
|
||||
@@ -53,7 +53,7 @@ Lettre does not provide (for now):
|
||||
|
||||
## Example
|
||||
|
||||
This library requires Rust 1.40 or newer.
|
||||
This library requires Rust 1.45 or newer.
|
||||
To use this library, add the following to your `Cargo.toml`:
|
||||
|
||||
|
||||
|
||||
@@ -16,19 +16,16 @@ pub fn encode(s: &str) -> String {
|
||||
}
|
||||
|
||||
pub fn decode(s: &str) -> Option<String> {
|
||||
const PREFIX: &str = "=?utf-8?b?";
|
||||
const SUFFIX: &str = "?=";
|
||||
|
||||
let s = s.trim();
|
||||
if s.starts_with(PREFIX) && s.ends_with(SUFFIX) {
|
||||
let s = &s[PREFIX.len()..];
|
||||
let s = &s[..s.len() - SUFFIX.len()];
|
||||
base64::decode(s)
|
||||
.ok()
|
||||
.and_then(|v| String::from_utf8(v).ok())
|
||||
} else {
|
||||
Some(s.into())
|
||||
}
|
||||
s.strip_prefix("=?utf-8?b?")
|
||||
.and_then(|stripped| stripped.strip_suffix("?="))
|
||||
.map_or_else(
|
||||
|| Some(s.into()),
|
||||
|stripped| {
|
||||
let decoded = base64::decode(stripped).ok()?;
|
||||
let decoded = String::from_utf8(decoded).ok()?;
|
||||
Some(decoded)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -151,10 +151,10 @@ impl Response {
|
||||
|
||||
/// Tells if the response is positive
|
||||
pub fn is_positive(&self) -> bool {
|
||||
match self.code.severity {
|
||||
Severity::PositiveCompletion | Severity::PositiveIntermediate => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(
|
||||
self.code.severity,
|
||||
Severity::PositiveCompletion | Severity::PositiveIntermediate
|
||||
)
|
||||
}
|
||||
|
||||
/// Tests code equality
|
||||
|
||||
Reference in New Issue
Block a user