Skip to content

Commit c97649d

Browse files
committed
chore: fix lint warnings emitted by newer clippy
1 parent a72c8b7 commit c97649d

File tree

5 files changed

+33
-35
lines changed

5 files changed

+33
-35
lines changed

jwt/src/dpop/verify.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,18 @@ impl VerifyDpop for &str {
7171
};
7272

7373
let claims = (*self).verify_jwt::<Dpop>(&pk, max_expiration, verify)?;
74-
if let Some(expected_htm) = htm {
75-
if expected_htm != claims.custom.htm {
76-
return Err(RustyJwtError::DpopHtmMismatch);
77-
}
74+
if let Some(expected_htm) = htm
75+
&& expected_htm != claims.custom.htm
76+
{
77+
return Err(RustyJwtError::DpopHtmMismatch);
7878
}
7979
if htu != &claims.custom.htu {
8080
return Err(RustyJwtError::DpopHtuMismatch);
8181
}
82-
if let Some(chal) = challenge {
83-
if chal != &claims.custom.challenge {
84-
return Err(RustyJwtError::DpopChallengeMismatch);
85-
}
82+
if let Some(chal) = challenge
83+
&& chal != &claims.custom.challenge
84+
{
85+
return Err(RustyJwtError::DpopChallengeMismatch);
8686
}
8787
if &claims.custom.handle != handle {
8888
return Err(RustyJwtError::DpopHandleMismatch);

x509-check/src/revocation/cache.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ impl RevocationStatusCache for RevocationCache {
3232
return PathValidationStatus::RevocationStatusNotDetermined;
3333
};
3434

35-
if let Some(status_and_time) = cache_map.get(&get_name_serial_pair(cert)) {
36-
if status_and_time.valid_until > time_of_interest {
37-
return status_and_time.status;
38-
}
35+
if let Some(status_and_time) = cache_map.get(&get_name_serial_pair(cert))
36+
&& status_and_time.valid_until > time_of_interest
37+
{
38+
return status_and_time.status;
3939
}
4040

4141
PathValidationStatus::RevocationStatusNotDetermined

x509-check/src/revocation/crl_info.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ impl TryFrom<&CertificateList> for CrlInfo {
124124
}
125125
} // end ID_CE_ISSUING_DISTRIBUTION_POINT
126126
ID_CE_AUTHORITY_KEY_IDENTIFIER => {
127-
if let Ok(akid) = AuthorityKeyIdentifier::from_der(ext.extn_value.as_bytes()) {
128-
if let Some(kid) = akid.key_identifier {
129-
skid = Some(kid.as_bytes().to_vec());
130-
}
127+
if let Ok(akid) = AuthorityKeyIdentifier::from_der(ext.extn_value.as_bytes())
128+
&& let Some(kid) = akid.key_identifier
129+
{
130+
skid = Some(kid.as_bytes().to_vec());
131131
}
132132
}
133133
ID_CE_DELTA_CRL_INDICATOR => {

x509-check/src/revocation/crl_store.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,19 +140,18 @@ impl CrlSource for CrlStore {
140140
// AKI matching
141141
if let Ok(Some(PDVExtension::AuthorityKeyIdentifier(akid))) =
142142
cert.get_extension(&ID_CE_AUTHORITY_KEY_IDENTIFIER)
143+
&& let Some(kid) = &akid.key_identifier
143144
{
144-
if let Some(kid) = &akid.key_identifier {
145-
let skids = self.sk_ids.lock().map_err(|_| certval::Error::Unrecognized)?;
146-
let kid_bytes = kid.as_bytes();
147-
if let Some(indices) = skids.get(kid_bytes) {
148-
let mut retval = vec![];
149-
for index in indices {
150-
if let Some(crl) = crls.get(*index) {
151-
retval.push(crl.to_der()?);
152-
}
145+
let skids = self.sk_ids.lock().map_err(|_| certval::Error::Unrecognized)?;
146+
let kid_bytes = kid.as_bytes();
147+
if let Some(indices) = skids.get(kid_bytes) {
148+
let mut retval = vec![];
149+
for index in indices {
150+
if let Some(crl) = crls.get(*index) {
151+
retval.push(crl.to_der()?);
153152
}
154-
return Ok(retval);
155153
}
154+
return Ok(retval);
156155
}
157156
}
158157

x509-check/src/revocation/misc.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ pub(crate) fn check_crl_valid_at_toi(toi: u64, crl: &CertificateList) -> bool {
1515
return false;
1616
}
1717

18-
if let Some(nu) = crl.tbs_cert_list.next_update {
19-
if nu.to_unix_duration().as_secs() < toi {
20-
return false;
21-
}
18+
if let Some(nu) = crl.tbs_cert_list.next_update
19+
&& nu.to_unix_duration().as_secs() < toi
20+
{
21+
return false;
2222
}
2323

2424
true
@@ -27,14 +27,13 @@ pub(crate) fn check_crl_valid_at_toi(toi: u64, crl: &CertificateList) -> bool {
2727
pub(crate) fn get_dp_from_crl(crl: &CertificateList) -> Option<Vec<u8>> {
2828
if let Some(exts) = &crl.tbs_cert_list.crl_extensions {
2929
for ext in exts {
30-
if ext.extn_id == ID_CE_ISSUING_DISTRIBUTION_POINT {
31-
if let Some(enc_dp) = IssuingDistributionPoint::from_der(ext.extn_value.as_bytes())
30+
if ext.extn_id == ID_CE_ISSUING_DISTRIBUTION_POINT
31+
&& let Some(enc_dp) = IssuingDistributionPoint::from_der(ext.extn_value.as_bytes())
3232
.ok()
3333
.and_then(|idp| idp.distribution_point)
3434
.and_then(|dp| dp.to_der().ok())
35-
{
36-
return Some(enc_dp);
37-
}
35+
{
36+
return Some(enc_dp);
3837
}
3938
}
4039
}

0 commit comments

Comments
 (0)