Skip to content

Commit

Permalink
make clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
UMR1352 committed Dec 11, 2024
1 parent 3f992c4 commit 66f7b79
Show file tree
Hide file tree
Showing 29 changed files with 26 additions and 226 deletions.
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ members = [
"identity_ecdsa_verifier",
"identity_eddsa_verifier",
"examples",
"compound_resolver",
]

exclude = ["bindings/wasm", "bindings/grpc"]
Expand All @@ -35,7 +34,6 @@ edition = "2021"
homepage = "https://www.iota.org"
license = "Apache-2.0"
repository = "https://github.com/iotaledger/identity.rs"
rust-version = "1.65"

[workspace.lints.clippy]
result_large_err = "allow"
21 changes: 0 additions & 21 deletions compound_resolver/Cargo.toml

This file was deleted.

162 changes: 0 additions & 162 deletions compound_resolver/src/lib.rs

This file was deleted.

1 change: 0 additions & 1 deletion identity_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ keywords = ["iota", "tangle", "identity"]
license.workspace = true
readme = "./README.md"
repository.workspace = true
rust-version.workspace = true
description = "The core traits and types for the identity-rs library."

[dependencies]
Expand Down
1 change: 0 additions & 1 deletion identity_credential/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ keywords = ["iota", "tangle", "identity"]
license.workspace = true
readme = "./README.md"
repository.workspace = true
rust-version.workspace = true
description = "An implementation of the Verifiable Credentials standard."

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion identity_credential/src/credential/jwt_serialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ where
}

#[cfg(feature = "validator")]
impl<'credential, T> CredentialJwtClaims<'credential, T>
impl<T> CredentialJwtClaims<'_, T>
where
T: ToOwned<Owned = T> + Serialize + DeserializeOwned,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ use super::DomainLinkageValidationResult;
use crate::utils::url_only_includes_origin;

/// A validator for a Domain Linkage Configuration and Credentials.
pub struct JwtDomainLinkageValidator<V: JwsVerifier> {
validator: JwtCredentialValidator<V>,
}
Expand Down
2 changes: 1 addition & 1 deletion identity_credential/src/presentation/jwt_serialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ where
}

#[cfg(feature = "validator")]
impl<'presentation, CRED, T> PresentationJwtClaims<'presentation, CRED, T>
impl<CRED, T> PresentationJwtClaims<'_, CRED, T>
where
CRED: ToOwned<Owned = CRED> + Serialize + DeserializeOwned + Clone,
T: ToOwned<Owned = T> + Serialize + DeserializeOwned,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ where
D: serde::Deserializer<'de>,
{
struct ExactStrVisitor(&'static str);
impl<'a> Visitor<'a> for ExactStrVisitor {
impl Visitor<'_> for ExactStrVisitor {
type Value = &'static str;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "the exact string \"{}\"", self.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ where
D: serde::Deserializer<'de>,
{
struct ExactStrVisitor(&'static str);
impl<'a> Visitor<'a> for ExactStrVisitor {
impl Visitor<'_> for ExactStrVisitor {
type Value = &'static str;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "the exact string \"{}\"", self.0)
Expand Down
14 changes: 6 additions & 8 deletions identity_credential/src/sd_jwt_vc/metadata/claim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,11 @@ fn index_value<'v>(value: &'v Value, segment: &ClaimPathSegment) -> anyhow::Resu

#[cfg(test)]
mod tests {
use std::cell::LazyCell;

use serde_json::json;

use super::*;

const SAMPLE_OBJ: LazyCell<Value> = LazyCell::new(|| {
fn sample_obj() -> Value {
json!({
"vct": "https://betelgeuse.example.com/education_credential",
"name": "Arthur Dent",
Expand All @@ -258,7 +256,7 @@ mod tests {
],
"nationalities": ["British", "Betelgeusian"]
})
});
}

#[test]
fn claim_path_works() {
Expand All @@ -268,18 +266,18 @@ mod tests {
let degrees_types_path = serde_json::from_value::<ClaimPath>(json!(["degrees", null, "type"])).unwrap();

assert!(matches!(
name_path.reverse_index(&SAMPLE_OBJ).unwrap(),
name_path.reverse_index(&sample_obj()).unwrap(),
OneOrManyValue::One(&Value::String(_))
));
assert!(matches!(
city_path.reverse_index(&SAMPLE_OBJ).unwrap(),
city_path.reverse_index(&sample_obj()).unwrap(),
OneOrManyValue::One(&Value::String(_))
));
assert!(matches!(
first_degree_path.reverse_index(&SAMPLE_OBJ).unwrap(),
first_degree_path.reverse_index(&sample_obj()).unwrap(),
OneOrManyValue::One(&Value::Object(_))
));
let obj = &*SAMPLE_OBJ;
let obj = &sample_obj();
let mut degree_types = degrees_types_path.reverse_index(obj).unwrap().into_iter();
assert_eq!(degree_types.next().unwrap().as_str(), Some("Bachelor of Science"));
assert_eq!(degree_types.next().unwrap().as_str(), Some("Master of Science"));
Expand Down
6 changes: 3 additions & 3 deletions identity_credential/src/sd_jwt_vc/metadata/vc_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ pub enum TypeSchema {

#[cfg(test)]
mod tests {
use std::cell::LazyCell;
use std::sync::LazyLock;

use async_trait::async_trait;
use serde_json::json;
Expand All @@ -194,7 +194,7 @@ mod tests {

use super::*;

const IMMEDIATE_TYPE_METADATA: LazyCell<TypeMetadata> = LazyCell::new(|| TypeMetadata {
static IMMEDIATE_TYPE_METADATA: LazyLock<TypeMetadata> = LazyLock::new(|| TypeMetadata {
name: Some("immediate credential".to_string()),
description: None,
extends: None,
Expand All @@ -218,7 +218,7 @@ mod tests {
schema_integrity: None,
}),
});
const REFERENCED_TYPE_METADATA: LazyCell<TypeMetadata> = LazyCell::new(|| TypeMetadata {
static REFERENCED_TYPE_METADATA: LazyLock<TypeMetadata> = LazyLock::new(|| TypeMetadata {
name: Some("immediate credential".to_string()),
description: None,
extends: None,
Expand Down
6 changes: 3 additions & 3 deletions identity_credential/src/sd_jwt_vc/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,16 +443,16 @@ impl From<SdJwtVc> for SdJwt {

#[cfg(test)]
mod tests {
use std::cell::LazyCell;
use std::sync::LazyLock;

use identity_core::common::StringOrUrl;
use identity_core::common::Url;

use super::*;

const EXAMPLE_SD_JWT_VC: &str = "eyJhbGciOiAiRVMyNTYiLCAidHlwIjogInZjK3NkLWp3dCJ9.eyJfc2QiOiBbIjBIWm1uU0lQejMzN2tTV2U3QzM0bC0tODhnekppLWVCSjJWel9ISndBVGciLCAiOVpicGxDN1RkRVc3cWFsNkJCWmxNdHFKZG1lRU9pWGV2ZEpsb1hWSmRSUSIsICJJMDBmY0ZVb0RYQ3VjcDV5eTJ1anFQc3NEVkdhV05pVWxpTnpfYXdEMGdjIiwgIklFQllTSkdOaFhJbHJRbzU4eWtYbTJaeDN5bGw5WmxUdFRvUG8xN1FRaVkiLCAiTGFpNklVNmQ3R1FhZ1hSN0F2R1RyblhnU2xkM3o4RUlnX2Z2M2ZPWjFXZyIsICJodkRYaHdtR2NKUXNCQ0EyT3RqdUxBY3dBTXBEc2FVMG5rb3ZjS09xV05FIiwgImlrdXVyOFE0azhxM1ZjeUE3ZEMtbU5qWkJrUmVEVFUtQ0c0bmlURTdPVFUiLCAicXZ6TkxqMnZoOW80U0VYT2ZNaVlEdXZUeWtkc1dDTmcwd1RkbHIwQUVJTSIsICJ3elcxNWJoQ2t2a3N4VnZ1SjhSRjN4aThpNjRsbjFqb183NkJDMm9hMXVnIiwgInpPZUJYaHh2SVM0WnptUWNMbHhLdUVBT0dHQnlqT3FhMXoySW9WeF9ZRFEiXSwgImlzcyI6ICJodHRwczovL2V4YW1wbGUuY29tL2lzc3VlciIsICJpYXQiOiAxNjgzMDAwMDAwLCAiZXhwIjogMTg4MzAwMDAwMCwgInZjdCI6ICJodHRwczovL2JtaS5idW5kLmV4YW1wbGUvY3JlZGVudGlhbC9waWQv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dmpXZWgzVHN1OTFDbmxuZUkifQ.GqtiTKNe3O95GLpdxFK_2FZULFk6KUscFe7RPk8OeVLiJiHsGvtPyq89e_grBplvGmnDGHoy8JAt1wQqiwktSg";
const EXAMPLE_ISSUER: LazyCell<Url> = LazyCell::new(|| "https://example.com/issuer".parse().unwrap());
const EXAMPLE_VCT: LazyCell<StringOrUrl> = LazyCell::new(|| {
static EXAMPLE_ISSUER: LazyLock<Url> = LazyLock::new(|| "https://example.com/issuer".parse().unwrap());
static EXAMPLE_VCT: LazyLock<StringOrUrl> = LazyLock::new(|| {
"https://bmi.bund.example/credential/pid/1.0"
.parse::<Url>()
.unwrap()
Expand Down
1 change: 0 additions & 1 deletion identity_document/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ keywords = ["iota", "tangle", "identity", "did"]
license.workspace = true
readme = "./README.md"
repository.workspace = true
rust-version.workspace = true
description = "Method-agnostic implementation of the Decentralized Identifiers (DID) standard."

[dependencies]
Expand Down
4 changes: 2 additions & 2 deletions identity_document/src/document/core_document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ impl CoreDocument {
&'me self,
method_query: Q,
scope: Option<MethodScope>,
) -> Option<&VerificationMethod>
) -> Option<&'me VerificationMethod>
where
Q: Into<DIDUrlQuery<'query>>,
{
Expand Down Expand Up @@ -773,7 +773,7 @@ impl CoreDocument {
/// Returns the first [`Service`] with an `id` property matching the provided `service_query`, if present.
// NOTE: This method demonstrates unexpected behavior in the edge cases where the document contains
// services whose ids are of the form <did different from this document's>#<fragment>.
pub fn resolve_service<'query, 'me, Q>(&'me self, service_query: Q) -> Option<&Service>
pub fn resolve_service<'query, 'me, Q>(&'me self, service_query: Q) -> Option<&'me Service>
where
Q: Into<DIDUrlQuery<'query>>,
{
Expand Down
4 changes: 2 additions & 2 deletions identity_document/src/utils/did_url_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use identity_did::DID;
#[repr(transparent)]
pub struct DIDUrlQuery<'query>(Cow<'query, str>);

impl<'query> DIDUrlQuery<'query> {
impl DIDUrlQuery<'_> {
/// Returns whether this query matches the given DIDUrl.
pub(crate) fn matches(&self, did_url: &DIDUrl) -> bool {
// Ensure the DID matches if included in the query.
Expand Down Expand Up @@ -81,7 +81,7 @@ impl<'query> From<&'query DIDUrl> for DIDUrlQuery<'query> {
}
}

impl<'query> From<DIDUrl> for DIDUrlQuery<'query> {
impl From<DIDUrl> for DIDUrlQuery<'_> {
fn from(other: DIDUrl) -> Self {
Self(Cow::Owned(other.to_string()))
}
Expand Down
Loading

0 comments on commit 66f7b79

Please sign in to comment.