From 406031991ff3d25e33ca7c74ac1c3790b303e67a Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Sun, 24 May 2020 10:37:27 -0700 Subject: [PATCH] Run rustfmt on github actions --- .github/workflows/ci.yml | 25 +++++++++++++++++++++++++ openssl-sys/build/find_normal.rs | 5 +---- openssl-sys/src/evp.rs | 2 +- openssl-sys/src/pem.rs | 4 +--- openssl/src/pkey.rs | 8 ++------ openssl/src/sign.rs | 6 +++++- openssl/src/ssl/bio.rs | 2 +- openssl/src/symm.rs | 8 ++++---- 8 files changed, 40 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..14c0f9bdc --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +name: CI + +on: + pull_request: + branches: + - master + push: + branches: + - master + - github-actions + +env: + RUSTFLAGS: -Dwarnings + RUST_BACKTRACE: 1 + +jobs: + rustfmt: + name: rustfmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install Rust + run: rustup update stable && rustup default stable + - name: Check formatting + run: cargo fmt --all -- --check diff --git a/openssl-sys/build/find_normal.rs b/openssl-sys/build/find_normal.rs index b1bdd0c70..0623a4090 100644 --- a/openssl-sys/build/find_normal.rs +++ b/openssl-sys/build/find_normal.rs @@ -207,10 +207,7 @@ fn try_vcpkg() { .find_package("openssl"); if let Err(e) = lib { - println!( - "note: vcpkg did not find openssl: {}", - e - ); + println!("note: vcpkg did not find openssl: {}", e); return; } diff --git a/openssl-sys/src/evp.rs b/openssl-sys/src/evp.rs index 685b9e278..b77997f0f 100644 --- a/openssl-sys/src/evp.rs +++ b/openssl-sys/src/evp.rs @@ -167,7 +167,7 @@ extern "C" { pub fn EVP_DecryptFinal_ex( ctx: *mut EVP_CIPHER_CTX, outm: *mut c_uchar, - outl: *mut c_int + outl: *mut c_int, ) -> c_int; } cfg_if! { diff --git a/openssl-sys/src/pem.rs b/openssl-sys/src/pem.rs index 474cefd29..cb1e93c6a 100644 --- a/openssl-sys/src/pem.rs +++ b/openssl-sys/src/pem.rs @@ -142,9 +142,7 @@ extern "C" { buf: *mut *const u8, length: c_long, ) -> *mut PKCS8_PRIV_KEY_INFO; - pub fn PKCS8_PRIV_KEY_INFO_free( - p8inf: *mut PKCS8_PRIV_KEY_INFO, - ); + pub fn PKCS8_PRIV_KEY_INFO_free(p8inf: *mut PKCS8_PRIV_KEY_INFO); pub fn PEM_read_bio_PKCS7( bio: *mut BIO, diff --git a/openssl/src/pkey.rs b/openssl/src/pkey.rs index 76381d02a..c9d986435 100644 --- a/openssl/src/pkey.rs +++ b/openssl/src/pkey.rs @@ -527,10 +527,7 @@ impl PKey { /// Deserializes a DER-formatted PKCS#8 unencrypted private key. /// /// This method is mainly for interoperability reasons. Encrypted keyfiles should be preferred. - pub fn private_key_from_pkcs8( - der: &[u8], - ) -> Result, ErrorStack> - { + pub fn private_key_from_pkcs8(der: &[u8]) -> Result, ErrorStack> { unsafe { ffi::init(); let len = der.len().min(c_long::max_value() as usize) as c_long; @@ -539,8 +536,7 @@ impl PKey { &mut der.as_ptr(), len, ))?; - let res = cvt_p(ffi::EVP_PKCS82PKEY(p8inf)) - .map(|p| PKey::from_ptr(p)); + let res = cvt_p(ffi::EVP_PKCS82PKEY(p8inf)).map(|p| PKey::from_ptr(p)); ffi::PKCS8_PRIV_KEY_INFO_free(p8inf); res } diff --git a/openssl/src/sign.rs b/openssl/src/sign.rs index 075488935..81ba7ee4b 100644 --- a/openssl/src/sign.rs +++ b/openssl/src/sign.rs @@ -354,7 +354,11 @@ impl<'a> Signer<'a> { /// /// [`EVP_DigestSign`]: https://www.openssl.org/docs/man1.1.1/man3/EVP_DigestSign.html #[cfg(ossl111)] - pub fn sign_oneshot(&mut self, sig_buf: &mut [u8], data_buf: &[u8]) -> Result { + pub fn sign_oneshot( + &mut self, + sig_buf: &mut [u8], + data_buf: &[u8], + ) -> Result { unsafe { let mut sig_len = sig_buf.len(); cvt(ffi::EVP_DigestSign( diff --git a/openssl/src/ssl/bio.rs b/openssl/src/ssl/bio.rs index 6bd81ffe3..8f3ff2282 100644 --- a/openssl/src/ssl/bio.rs +++ b/openssl/src/ssl/bio.rs @@ -1,6 +1,6 @@ use ffi::{ self, BIO_clear_retry_flags, BIO_new, BIO_set_retry_read, BIO_set_retry_write, BIO, - BIO_CTRL_FLUSH, BIO_CTRL_DGRAM_QUERY_MTU, + BIO_CTRL_DGRAM_QUERY_MTU, BIO_CTRL_FLUSH, }; use libc::{c_char, c_int, c_long, c_void, strlen}; use std::any::Any; diff --git a/openssl/src/symm.rs b/openssl/src/symm.rs index b154d8698..8bad5c178 100644 --- a/openssl/src/symm.rs +++ b/openssl/src/symm.rs @@ -320,9 +320,9 @@ impl Cipher { /// Determines whether the cipher is using OCB mode #[cfg(ossl110)] fn is_ocb(&self) -> bool { - *self == Cipher::aes_128_ocb() || - *self == Cipher::aes_192_ocb() || - *self == Cipher::aes_256_ocb() + *self == Cipher::aes_128_ocb() + || *self == Cipher::aes_192_ocb() + || *self == Cipher::aes_256_ocb() } #[cfg(not(ossl110))] @@ -1458,7 +1458,7 @@ mod tests { ) .unwrap(); assert_eq!(pt, hex::encode(out)); - } + } #[test] #[cfg(ossl110)] -- GitLab