diff --git a/tests/x509_limbo.rs b/tests/x509_limbo.rs index eda5280c..dfeeec4c 100644 --- a/tests/x509_limbo.rs +++ b/tests/x509_limbo.rs @@ -18,7 +18,7 @@ use webpki::{ #[ignore] // Runs slower than other unit tests - opt-in with `cargo test -- --include-ignored` #[test] fn x509_limbo() { - let limbo: Limbo = serde_json::from_slice(LIMBO_JSON).expect("invalid test JSON"); + let limbo = serde_json::from_slice::(LIMBO_JSON).expect("invalid test JSON"); let exceptions = serde_json::from_reader( File::open("third-party/x509-limbo/exceptions.json") @@ -69,21 +69,18 @@ fn evaluate_testcase(tc: &Testcase, exceptions: &HashMap) -> } let validation_result = run_validation(tc); - let actual_success = validation_result.is_ok(); - let expected_success = matches!(tc.expected_result, ExpectedResult::Success); - if let Some(exception) = exceptions.get(tc.id.as_str()) { - if actual_success == (exception.actual == "SUCCESS") { + if validation_result.is_ok() == (exception.actual == "SUCCESS") { return Outcome::KnownDivergence; } // If the exception no longer applies (behavior changed), fall through to normal comparison } // Compare actual vs expected - match (expected_success, validation_result) { - (true, Ok(())) | (false, Err(_)) => Outcome::Pass, - (true, Err(err)) => Outcome::UnexpectedFailure(err), - (false, Ok(())) => Outcome::UnexpectedSuccess, + match (tc.expected_result, validation_result) { + (ExpectedResult::Success, Ok(())) | (ExpectedResult::Failure, Err(_)) => Outcome::Pass, + (ExpectedResult::Success, Err(err)) => Outcome::UnexpectedFailure(err), + (ExpectedResult::Failure, Ok(())) => Outcome::UnexpectedSuccess, } } @@ -93,22 +90,22 @@ fn run_validation(tc: &Testcase) -> Result<(), String> { let leaf = EndEntityCert::try_from(&leaf_der).map_err(|e| format!("leaf cert parse failed: {e}"))?; - let intermediates: Vec<_> = tc + let intermediates = tc .untrusted_intermediates .iter() .map(|ic| cert_der_from_pem(ic)) - .collect(); + .collect::>(); - let trust_anchor_ders: Vec<_> = tc + let trust_anchor_ders = tc .trusted_certs .iter() .map(|ta| cert_der_from_pem(ta)) - .collect(); + .collect::>(); - let trust_anchors: Vec<_> = trust_anchor_ders + let trust_anchors = trust_anchor_ders .iter() .filter_map(|der| anchor_from_trusted_cert(der).ok()) - .collect(); + .collect::>(); if trust_anchors.is_empty() && !trust_anchor_ders.is_empty() { return Err("trust anchor extraction failed".into()); @@ -122,7 +119,7 @@ fn run_validation(tc: &Testcase) -> Result<(), String> { let sig_algs = rustls_aws_lc_rs::ALL_VERIFICATION_ALGS; - let crls: Vec<_> = tc + let crls = tc .crls .iter() .map(|pem| { @@ -134,8 +131,8 @@ fn run_validation(tc: &Testcase) -> Result<(), String> { .expect("CRL DER parse failed") .into() }) - .collect(); - let crls: Vec<_> = crls.iter().collect(); + .collect::>(); + let crls = crls.iter().collect::>(); let revocation_options = if !crls.is_empty() { let opts = RevocationOptionsBuilder::new(crls.as_slice()).unwrap();