summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2023-05-14 21:48:31 -0400
committerGitHub <noreply@github.com>2023-05-15 09:48:31 +0800
commitd7996dc01fb23cc737678d67f322b1b62a034cd2 (patch)
treec8032278a32c8f3380b4b3c8a8952d5078a9d204
parent24c582a1dc0bc07da4247b938cf293a04010c0a9 (diff)
downloadcryptography-d7996dc01fb23cc737678d67f322b1b62a034cd2.tar.gz
Run full nox rust env in coverage jobs (#8924)
* Run full nox rust env in coverage jobs * Update ci.yml * Update ci.yml * fix 1.60 clippy warnings * warning name changed
-rw-r--r--.github/workflows/ci.yml15
-rw-r--r--src/rust/cryptography-x509/src/lib.rs2
-rw-r--r--src/rust/src/pkcs7.rs28
3 files changed, 20 insertions, 25 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index c11defdbb..d50e8f1d0 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -267,7 +267,7 @@ jobs:
id: rust-toolchain
with:
toolchain: ${{ matrix.RUST }}
- components: llvm-tools-preview
+ components: llvm-tools-preview,rustfmt,clippy
- name: Cache rust and pip
id: cargo-cache
uses: ./.github/actions/cache
@@ -304,27 +304,20 @@ jobs:
- name: Clone wycheproof
timeout-minutes: 2
uses: ./.github/actions/wycheproof
- - run: python -m pip install -c ci-constraints-requirements.txt 'nox' cffi
+ - run: python -m pip install -c ci-constraints-requirements.txt 'nox'
- name: Create nox environment
- run: nox -v --install-only -s tests
+ run: nox -v --install-only -s tests rust
env:
CARGO_TARGET_DIR: ${{ format('{0}/src/rust/target/', github.workspace) }}
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "rust-cov/cov-%p.profraw"
- name: Tests
- run: nox --no-install -s tests -- --color=yes --wycheproof-root=wycheproof
+ run: nox --no-install -s tests rust -- --color=yes --wycheproof-root=wycheproof
env:
COLUMNS: 80
CARGO_TARGET_DIR: ${{ format('{0}/src/rust/target/', github.workspace) }}
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "rust-cov/cov-%p.profraw"
- - name: Rust Tests
- run: |
- cd src/rust
- cargo test --no-default-features --all
- env:
- RUSTFLAGS: "-Cinstrument-coverage"
- LLVM_PROFILE_FILE: "rust-cov/cov-%m-%p.profraw"
- name: Process coverage data
run: |
set -xe
diff --git a/src/rust/cryptography-x509/src/lib.rs b/src/rust/cryptography-x509/src/lib.rs
index 548e073b1..131c3fd15 100644
--- a/src/rust/cryptography-x509/src/lib.rs
+++ b/src/rust/cryptography-x509/src/lib.rs
@@ -3,6 +3,8 @@
// for complete details.
#![forbid(unsafe_code)]
+// These can be removed once our MSRV is >1.60
+#![allow(renamed_and_removed_lints, clippy::eval_order_dependence)]
pub mod certificate;
pub mod common;
diff --git a/src/rust/src/pkcs7.rs b/src/rust/src/pkcs7.rs
index 6a49acf98..d2c500a72 100644
--- a/src/rust/src/pkcs7.rs
+++ b/src/rust/src/pkcs7.rs
@@ -139,20 +139,20 @@ fn sign_and_serialize<'p>(
)?,
)
} else {
- let mut authenticated_attrs = vec![];
-
- authenticated_attrs.push(Attribute {
- type_id: PKCS7_CONTENT_TYPE_OID,
- values: common::Asn1ReadableOrWritable::new_write(asn1::SetOfWriter::new([
- asn1::parse_single(&content_type_bytes).unwrap(),
- ])),
- });
- authenticated_attrs.push(Attribute {
- type_id: PKCS7_SIGNING_TIME_OID,
- values: common::Asn1ReadableOrWritable::new_write(asn1::SetOfWriter::new([
- asn1::parse_single(&signing_time_bytes).unwrap(),
- ])),
- });
+ let mut authenticated_attrs = vec![
+ Attribute {
+ type_id: PKCS7_CONTENT_TYPE_OID,
+ values: common::Asn1ReadableOrWritable::new_write(asn1::SetOfWriter::new([
+ asn1::parse_single(&content_type_bytes).unwrap(),
+ ])),
+ },
+ Attribute {
+ type_id: PKCS7_SIGNING_TIME_OID,
+ values: common::Asn1ReadableOrWritable::new_write(asn1::SetOfWriter::new([
+ asn1::parse_single(&signing_time_bytes).unwrap(),
+ ])),
+ },
+ ];
let digest =
asn1::write_single(&x509::ocsp::hash_data(py, py_hash_alg, &data_with_header)?)?;