diff --git a/.cargo/config.toml b/.cargo/config.toml index e3432467..42bbb13f 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,2 +1,3 @@ [alias] clippy-ci = "clippy --all-features --all-targets --all" +clippy-msrv-ci = "clippy --all-features --lib --all" # Only check --lib target w/ MSRV toolchain. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3c585be1..ec17adce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,9 @@ on: - main - "*_dev" pull_request: + merge_group: + schedule: + - cron: '0 18 * * *' name: CI permissions: @@ -22,24 +25,17 @@ jobs: - ubuntu-latest - macos-latest - windows-latest - rust: - - stable - # MSRV - - 1.56.0 steps: - uses: actions/checkout@v3 with: persist-credentials: false - - uses: actions-rs/toolchain@v1 + + - uses: dtolnay/rust-toolchain@stable with: - profile: minimal - toolchain: ${{ matrix.rust }} components: clippy - name: Clippy (${{ matrix.os }}) - uses: actions-rs/cargo@v1 - with: - command: clippy-ci + run: cargo clippy-ci - name: Clippy (Android) if: matrix.os == 'ubuntu-latest' @@ -61,6 +57,46 @@ jobs: # rustup target add wasm32-unknown-unknown # cargo clippy-ci --target wasm32-unknown-unknown + clippy-msrv: + name: Clippy (MSRV) + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-latest + - macos-latest + - windows-latest + steps: + - uses: actions/checkout@v3 + with: + persist-credentials: false + + - uses: dtolnay/rust-toolchain@master + with: + toolchain: "1.64.0" # MSRV + components: clippy + + - name: Install cargo-ndk. + run: | + cargo install cargo-ndk --version 2.12.7 + rustup target add aarch64-linux-android + + - name: Clippy (${{ matrix.os }}) + run: cargo clippy-msrv-ci + + - name: Clippy (Android) + if: matrix.os == 'ubuntu-latest' + run: | + cargo ndk -t arm64-v8a clippy-msrv-ci + + - name: Clippy (iOS) + if: matrix.os == 'macos-latest' + run: | + rustup target add x86_64-apple-ios + cargo clippy-msrv-ci --target x86_64-apple-ios + + # TODO: Consider WASM. See note on "clippy" job. + test: name: Test runs-on: ${{ matrix.os }} @@ -74,15 +110,11 @@ jobs: - uses: actions/checkout@v3 with: persist-credentials: false - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - + + - uses: dtolnay/rust-toolchain@stable + - name: Test (${{ matrix.os }}) - uses: actions-rs/cargo@v1 - with: - command: test + run: cargo test - name: Setup Android test environment uses: actions/setup-java@v2 @@ -137,15 +169,12 @@ jobs: - uses: actions/checkout@v3 with: persist-credentials: false - - uses: actions-rs/toolchain@v1 + + - uses: dtolnay/rust-toolchain@stable with: - profile: minimal - toolchain: stable components: rustfmt - - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check + + - run: cargo fmt --all -- --check android_fmt: name: Ktlint diff --git a/Cargo.toml b/Cargo.toml index 6d50acc2..09d2378e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ keywords = ["tls", "certificate", "verification", "os", "native"] repository = "https://github.com/1Password/rustls-platform-verifier" license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.56" +rust-version = "1.64.0" exclude = [ "android/.run", diff --git a/README.md b/README.md index 6b6a9c22..c3626b0e 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![crates.io version](https://img.shields.io/crates/v/rustls-platform-verifier.svg)](https://crates.io/crates/rustls-platform-verifier) [![crate documentation](https://docs.rs/rustls-platform-verifier/badge.svg)](https://docs.rs/rustls-platform-verifier) -![MSRV](https://img.shields.io/badge/rustc-1.56+-blue.svg) +![MSRV](https://img.shields.io/badge/rustc-1.64+-blue.svg) [![crates.io downloads](https://img.shields.io/crates/d/rustls-platform-verifier.svg)](https://crates.io/crates/rustls-platform-verifier) ![CI](https://github.com/1Password/rustls-platform-verifier/workflows/CI/badge.svg) @@ -159,4 +159,4 @@ Licensed under either of Apache License, Version Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. - \ No newline at end of file + diff --git a/src/verification/android.rs b/src/verification/android.rs index 5bda06a5..90239095 100644 --- a/src/verification/android.rs +++ b/src/verification/android.rs @@ -248,7 +248,7 @@ fn extract_result_info(env: &JNIEnv<'_>, result: JObject<'_>) -> (VerifierStatus let msg = env .get_field(result, "message", "Ljava/lang/String;") .and_then(|m| m.l()) - .map(|o| (!o.is_null()).then(|| o)) + .map(|o| (!o.is_null()).then_some(o)) .and_then(|s| s.map(|s| JavaStr::from_env(env, s.into())).transpose()) .unwrap(); diff --git a/src/verification/windows.rs b/src/verification/windows.rs index cddab88c..23952bfc 100644 --- a/src/verification/windows.rs +++ b/src/verification/windows.rs @@ -184,7 +184,7 @@ impl Certificate { CERT_SET_PROPERTY_IGNORE_PERSIST_ERROR_FLAG, prop_data, ) == TRUE) - .then(|| ()) + .then_some(()) }) } }