Skip to content

Commit 8e98b9a

Browse files
fix clippy and CI
1 parent 009854d commit 8e98b9a

File tree

8 files changed

+20
-24
lines changed

8 files changed

+20
-24
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
uses: actions-rs/cargo@v1
4343
with:
4444
command: test
45-
args: --all
45+
args: --all --no-default-features --features file-transport smtp-transport
4646

4747
check_fmt_and_docs:
4848
name: Checking fmt and docs
@@ -64,13 +64,15 @@ jobs:
6464
run: cargo doc
6565

6666
clippy_check:
67-
name: Clippy check
6867
runs-on: ubuntu-latest
6968
steps:
7069
- uses: actions/checkout@v1
71-
- name: Install rust
72-
run: rustup update beta && rustup default beta
73-
- name: Install clippy
74-
run: rustup component add clippy
75-
- name: clippy
76-
run: cargo clippy --all
70+
- uses: actions-rs/toolchain@v1
71+
with:
72+
toolchain: nightly
73+
components: clippy
74+
override: true
75+
- uses: actions-rs/clippy-check@v1
76+
with:
77+
token: ${{ secrets.GITHUB_TOKEN }}
78+
args: --all-features

src/file/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use async_std::fs::File;
99
use async_std::path::Path;
1010
use async_std::prelude::*;
1111
use async_trait::async_trait;
12-
use serde_json;
1312

1413
use crate::file::error::FileResult;
1514
use crate::Envelope;

src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
unstable_features,
99
unused_import_braces,
1010
missing_debug_implementations,
11-
clippy::result_unwrap_used,
12-
clippy::option_unwrap_used
11+
clippy::unwrap_used
1312
)]
1413

1514
pub mod error;

src/sendmail/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl SendmailTransport {
4040
}
4141
}
4242

43-
#[allow(clippy::option_unwrap_used)]
43+
#[allow(clippy::unwrap_used)]
4444
#[async_trait]
4545
impl<'a> Transport<'a> for SendmailTransport {
4646
type Result = SendmailResult;

src/smtp/commands.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ impl AuthCommand {
285285
challenge: Option<String>,
286286
) -> Result<AuthCommand, Error> {
287287
let response = if mechanism.supports_initial_response() || challenge.is_some() {
288-
Some(mechanism.response(&credentials, challenge.as_ref().map(String::as_str))?)
288+
Some(mechanism.response(&credentials, challenge.as_deref())?)
289289
} else {
290290
None
291291
};

src/smtp/extension.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl ServerInfo {
133133
}
134134

135135
let split: Vec<&str> = line.split_whitespace().collect();
136-
match split.get(0).map(|s| *s) {
136+
match split.get(0).copied() {
137137
Some("8BITMIME") => {
138138
features.insert(Extension::EightBitMime);
139139
}

src/smtp/response.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,10 @@ impl Response {
166166

167167
/// Tells if the response is positive
168168
pub fn is_positive(&self) -> bool {
169-
match self.code.severity {
170-
Severity::PositiveCompletion | Severity::PositiveIntermediate => true,
171-
_ => false,
172-
}
169+
matches!(
170+
self.code.severity,
171+
Severity::PositiveCompletion | Severity::PositiveIntermediate
172+
)
173173
}
174174

175175
/// Tests code equality

src/smtp/smtp_client.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ impl<'a> SmtpTransport {
407407
try_smtp!(client.command(StarttlsCommand).await, self);
408408
}
409409

410-
let client = std::mem::replace(&mut self.client, InnerClient::default());
410+
let client = std::mem::take(&mut self.client);
411411
let ssl_client = client.upgrade_tls_stream(tls_parameters).await?;
412412
self.client = ssl_client;
413413

@@ -552,11 +552,7 @@ impl<'a> Transport<'a> for SmtpTransport {
552552
"{}: conn_use={}, status=sent ({})",
553553
message_id,
554554
self.state.connection_reuse_count,
555-
result
556-
.message
557-
.iter()
558-
.next()
559-
.unwrap_or(&"no response".to_string())
555+
result.message.get(0).unwrap_or(&"no response".to_string())
560556
);
561557
}
562558

0 commit comments

Comments
 (0)