Skip to content

Commit

Permalink
Add CI for format and linter (#117)
Browse files Browse the repository at this point in the history
* Clean up clippy lint warnings

* Add CI for format and linter

---------

Co-authored-by: Eray Karatay <[email protected]>
  • Loading branch information
garlic-hub and programatik29 authored Jul 30, 2024
1 parent d743b49 commit 65b3df6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
tags:
- '*'

jobs:
check_cargo_fmt:
name: Check that 'cargo fmt' has been run
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --check

check_cargo_clippy:
name: Check that 'cargo clippy' has no warnings
runs-on: ubuntu-22.04
steps:
- run: sudo apt-get install pkg-config libssl-dev
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- run: cargo clippy --all-targets --all-features -- -Dwarnings
5 changes: 3 additions & 2 deletions src/tls_rustls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ use tokio::{
use tokio_rustls::server::TlsStream;

pub(crate) mod export {
#[allow(clippy::wildcard_imports)]
use super::*;

/// Create a tls server that will bind to provided address.
Expand Down Expand Up @@ -301,8 +302,8 @@ fn config_from_pem(cert: Vec<u8>, key: Vec<u8>) -> io::Result<ServerConfig> {
let mut key_vec: Vec<Vec<u8>> = rustls_pemfile::read_all(&mut key.as_ref())
.filter_map(|i| match i.ok()? {
Item::Sec1Key(key) => Some(key.secret_sec1_der().to_vec()),
Item::Pkcs1Key(key) => Some(key.secret_pkcs1_der().to_vec().into()),
Item::Pkcs8Key(key) => Some(key.secret_pkcs8_der().to_vec().into()),
Item::Pkcs1Key(key) => Some(key.secret_pkcs1_der().to_vec()),
Item::Pkcs8Key(key) => Some(key.secret_pkcs8_der().to_vec()),
_ => None,
})
.collect();
Expand Down

0 comments on commit 65b3df6

Please sign in to comment.