Skip to content

Commit

Permalink
Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
cobward committed Jul 31, 2024
1 parent 6b0d643 commit 01b5b56
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/core/authorization_request/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl fmt::Display for ClientIdScheme {
ClientIdScheme::EntityId => ENTITY_ID,
ClientIdScheme::PreRegistered => PREREGISTERED,
ClientIdScheme::RedirectUri => REDIRECT_URI,
ClientIdScheme::VerifierAttestation => VERIFIER_ATTESTATION.into(),
ClientIdScheme::VerifierAttestation => VERIFIER_ATTESTATION,
ClientIdScheme::X509SanDns => X509_SAN_DNS,
ClientIdScheme::X509SanUri => X509_SAN_URI,
ClientIdScheme::Other(o) => o,
Expand Down
2 changes: 1 addition & 1 deletion src/core/authorization_request/verification/x509_san.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub fn validate<V: Verifier>(
bail!("'x5c' header was not an array")
};

let Json::String(b64_x509) = x5chain.get(0).context("'x5c' was an empty array")? else {
let Json::String(b64_x509) = x5chain.first().context("'x5c' was an empty array")? else {
bail!("'x5c' header was not an array of strings");
};

Expand Down
10 changes: 5 additions & 5 deletions src/core/metadata/parameters/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,23 +250,23 @@ mod test {

#[test]
fn response_types_supported() {
let exp = vec![ResponseType::VpToken];
let exp = [ResponseType::VpToken];
let ResponseTypesSupported(v) = metadata().get().unwrap().unwrap();
assert!(exp.iter().all(|x| v.contains(x)));
assert!(v.iter().all(|x| exp.contains(x)));
}

#[test]
fn client_id_schemes_supported() {
let exp = vec![ClientIdScheme::RedirectUri, ClientIdScheme::X509SanUri];
let exp = [ClientIdScheme::RedirectUri, ClientIdScheme::X509SanUri];
let ClientIdSchemesSupported(v) = metadata().get().unwrap().unwrap();
assert!(exp.iter().all(|x| v.contains(x)));
assert!(v.iter().all(|x| exp.contains(x)));
}

#[test]
fn request_object_signing_alg_values_supported() {
let exp = vec!["ES256".to_string()];
let exp = ["ES256".to_string()];
let RequestObjectSigningAlgValuesSupported(v) = metadata().get().unwrap().unwrap();
assert!(exp.iter().all(|x| v.contains(x)));
assert!(v.iter().all(|x| exp.contains(x)));
Expand All @@ -284,15 +284,15 @@ mod test {

#[test]
fn authorization_encryption_alg_values_supported() {
let exp = vec!["ECDH-ES".to_string()];
let exp = ["ECDH-ES".to_string()];
let AuthorizationEncryptionAlgValuesSupported(v) = metadata().get().unwrap().unwrap();
assert!(exp.iter().all(|x| v.contains(x)));
assert!(v.iter().all(|x| exp.contains(x)));
}

#[test]
fn authorization_encryption_enc_values_supported() {
let exp = vec!["A256GCM".to_string()];
let exp = ["A256GCM".to_string()];
let AuthorizationEncryptionEncValuesSupported(v) = metadata().get().unwrap().unwrap();
assert!(exp.iter().all(|x| v.contains(x)));
assert!(v.iter().all(|x| exp.contains(x)));
Expand Down
6 changes: 3 additions & 3 deletions src/core/response/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ pub enum AuthorizationResponse {

impl AuthorizationResponse {
pub fn from_x_www_form_urlencoded(bytes: &[u8]) -> Result<Self> {
if let Ok(jwt) = serde_urlencoded::from_bytes(&bytes) {
if let Ok(jwt) = serde_urlencoded::from_bytes(bytes) {
return Ok(Self::Jwt(jwt));
}

let flattened = serde_urlencoded::from_bytes::<BTreeMap<String, String>>(&bytes)
let flattened = serde_urlencoded::from_bytes::<BTreeMap<String, String>>(bytes)
.context("failed to construct flat map")?;
let map = flattened
.into_iter()
Expand All @@ -33,7 +33,7 @@ impl AuthorizationResponse {
})
.collect();

return Ok(Self::Unencoded(UntypedObject(map).try_into()?));
Ok(Self::Unencoded(UntypedObject(map).try_into()?))
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/verifier/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl Verifier {
}

/// Begin building a new authorization request (credential presentation).
pub fn build_authorization_request<'a>(&'a self) -> RequestBuilder<'a> {
pub fn build_authorization_request(&self) -> RequestBuilder<'_> {
RequestBuilder::new(self)
}

Expand Down
2 changes: 1 addition & 1 deletion src/verifier/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl SessionStore for MemoryStore {
}

async fn remove_session(&self, uuid: Uuid) -> Result<()> {
if let Some(_) = self.store.try_lock()?.remove(&uuid) {
if self.store.try_lock()?.remove(&uuid).is_some() {
return Ok(());
}

Expand Down
2 changes: 1 addition & 1 deletion tests/jwt_vc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl RequestVerifier for JwtVcWallet {
) -> Result<()> {
did::verify_with_resolver(
self.metadata(),
&decoded_request,
decoded_request,
request_jwt,
Some(self.trusted_dids()),
DIDKey.to_resolver(),
Expand Down

0 comments on commit 01b5b56

Please sign in to comment.