diff --git a/src/core/authorization_request/parameters.rs b/src/core/authorization_request/parameters.rs index bd12fe1..0551291 100644 --- a/src/core/authorization_request/parameters.rs +++ b/src/core/authorization_request/parameters.rs @@ -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, diff --git a/src/core/authorization_request/verification/x509_san.rs b/src/core/authorization_request/verification/x509_san.rs index 07df646..ffff434 100644 --- a/src/core/authorization_request/verification/x509_san.rs +++ b/src/core/authorization_request/verification/x509_san.rs @@ -58,7 +58,7 @@ pub fn validate( 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"); }; diff --git a/src/core/metadata/parameters/wallet.rs b/src/core/metadata/parameters/wallet.rs index 27ef948..3454a01 100644 --- a/src/core/metadata/parameters/wallet.rs +++ b/src/core/metadata/parameters/wallet.rs @@ -250,7 +250,7 @@ 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))); @@ -258,7 +258,7 @@ mod test { #[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))); @@ -266,7 +266,7 @@ mod test { #[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))); @@ -284,7 +284,7 @@ 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))); @@ -292,7 +292,7 @@ mod test { #[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))); diff --git a/src/core/response/mod.rs b/src/core/response/mod.rs index 4971321..30fff9a 100644 --- a/src/core/response/mod.rs +++ b/src/core/response/mod.rs @@ -19,11 +19,11 @@ pub enum AuthorizationResponse { impl AuthorizationResponse { pub fn from_x_www_form_urlencoded(bytes: &[u8]) -> Result { - 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::>(&bytes) + let flattened = serde_urlencoded::from_bytes::>(bytes) .context("failed to construct flat map")?; let map = flattened .into_iter() @@ -33,7 +33,7 @@ impl AuthorizationResponse { }) .collect(); - return Ok(Self::Unencoded(UntypedObject(map).try_into()?)); + Ok(Self::Unencoded(UntypedObject(map).try_into()?)) } } diff --git a/src/verifier/mod.rs b/src/verifier/mod.rs index 812bf97..d179856 100644 --- a/src/verifier/mod.rs +++ b/src/verifier/mod.rs @@ -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) } diff --git a/src/verifier/session.rs b/src/verifier/session.rs index beb50af..0380b95 100644 --- a/src/verifier/session.rs +++ b/src/verifier/session.rs @@ -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(()); } diff --git a/tests/jwt_vc.rs b/tests/jwt_vc.rs index 4fb705f..99c4ef9 100644 --- a/tests/jwt_vc.rs +++ b/tests/jwt_vc.rs @@ -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(),