Skip to content

Commit

Permalink
fix all clippy and warnings
Browse files Browse the repository at this point in the history
Signed-off-by: gmulhearn <[email protected]>
  • Loading branch information
gmulhearn committed Dec 31, 2024
1 parent 3587593 commit 1dd7389
Show file tree
Hide file tree
Showing 20 changed files with 32 additions and 45 deletions.
22 changes: 9 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ panic = 'unwind'
incremental = false

[workspace.lints.clippy]
all = "warn"
pedantic = "warn"
all = { level = "warn", priority = -1 }
pedantic = { level = "warn", priority = -1 }
struct_excessive_bools = "allow"
trivially_copy_pass_by_ref = "allow"
must_use_candidate = "allow"
Expand All @@ -66,8 +66,6 @@ missing_copy_implementations = "warn"
missing_debug_implementations = "warn"
non_ascii_idents = "warn"
pointer_structural_match = "warn"
rust_2018_idioms = "warn"
rust_2021_compatibility = "warn"
trivial_casts = "warn"
trivial_numeric_casts = "warn"
unused_extern_crates = "warn"
Expand All @@ -93,15 +91,15 @@ bs58 = "0.5.1"
multibase = "0.9.1"
hex = "0.4.3"
pem = "3.0.4"
serde = "1.0.217"
serde = { version = "1.0.217", default-features = false }
serde_json = "1.0.134"
derive_more = "1.0.0"
async-trait = "0.1.83"
futures = "0.3.31"
futures = { version = "0.3.31", default-features = false }
log = "0.4.22"
url = "2.5.4"
uuid = "1.11.0"
chrono = "0.4.39"
url = { version = "2.5.4", default-features = false }
uuid = { version = "1.11.0", default-features = false, features = ["v4"] }
chrono = { version = "0.4.39", default-features = false }
typed-builder = "0.20.0"
thiserror = "2.0.9"
anyhow = "1.0.95"
Expand All @@ -119,7 +117,7 @@ syn = "2.0.93"
quote = "1.0.38"

# common drivers
tokio = "1.42.0"
tokio = { version = "1.42.0", default-features = false }
sqlx = "0.8.2"
reqwest = "0.12.11"
axum = "0.7.9"
Expand All @@ -137,7 +135,5 @@ uniffi = "0.23.0"

# TODO - await new indy-vdr release
[patch.'https://github.com/hyperledger/indy-vdr']
indy-vdr = { git = "https://github.com/anonyome/indy-vdr.git", rev = "34ada55", default-features = false, features = [
"log",
] }
indy-vdr = { git = "https://github.com/anonyome/indy-vdr.git", rev = "34ada55" }
indy-vdr-proxy-client = { git = "https://github.com/anonyome/indy-vdr.git", rev = "34ada55" }
2 changes: 1 addition & 1 deletion aries/agents/aath-backchannel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ serde.workspace = true
serde_json.workspace = true
log.workspace = true
env_logger.workspace = true
uuid = { workspace = true, features = ["serde", "v4"] }
uuid = { workspace = true, features = ["serde"] }
aries-vcx-agent = { path = "../../../aries/agents/aries-vcx-agent" }
anoncreds_types = { path = "../../../aries/misc/anoncreds_types" }
display_as_json = { path = "../../../misc/display_as_json" }
Expand Down
2 changes: 1 addition & 1 deletion aries/agents/mediator/client-tui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ aries_vcx_wallet = { path = "../../../aries_vcx_wallet", features = [
] }
axum.workspace = true
cursive = { version = "0.20.0", features = ["crossterm-backend"] }
futures.workspace = true
futures = { workspace = true, default-features = true }
log.workspace = true
mediator = { path = ".." }
messages = { path = "../../../messages" }
Expand Down
1 change: 0 additions & 1 deletion aries/agents/mediator/src/persistence/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ pub struct DecodeError(#[from] pub Box<dyn std::error::Error>);
/// with the help of thiserror.
/// Usage:
/// errorset!(ComposedError\[ErrorVariant1, ErrorVariant2\]);
macro_rules! error_compose {
($errorset_name:ident[$($error_name: ident),*]) => {
#[derive(Error, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion aries/aries_vcx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ base64.workspace = true
sha2.workspace = true
num-bigint = "0.4.5"
futures = { workspace = true, default-features = false }
uuid = { workspace = true, default-features = false, features = ["v4"] }
uuid = { workspace = true }
strum.workspace = true
strum_macros.workspace = true
derive_builder = "0.20.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ pub async fn build_schemas_json_verifier(
let mut schemas_json = json!({});

for cred_info in credential_data.iter() {
if schemas_json.get(&cred_info.schema_id.to_string()).is_none() {
if schemas_json.get(cred_info.schema_id.to_string()).is_none() {
let schema_id = &cred_info.schema_id;
let schema_json = ledger.get_schema(schema_id, None).await.map_err(|_err| {
AriesVcxError::from_msg(AriesVcxErrorKind::InvalidSchema, "Cannot get schema")
Expand Down
2 changes: 1 addition & 1 deletion aries/aries_vcx_anoncreds/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ did_parser_nom = { path = "../../did_core/did_parser_nom" }
async-trait.workspace = true
thiserror.workspace = true
log.workspace = true
uuid = { workspace = true, default-features = false, features = ["v4"] }
uuid = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
time.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion aries/aries_vcx_ledger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ tokio = { workspace = true, default-features = false, features = [
"rt",
] }
mockall.workspace = true
uuid = { workspace = true, default-features = false, features = ["v4"] }
uuid = { workspace = true }
2 changes: 1 addition & 1 deletion aries/aries_vcx_wallet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ rand.workspace = true
thiserror.workspace = true
tokio = { workspace = true }
typed-builder.workspace = true
uuid = { workspace = true, default-features = false, features = ["v4"] }
uuid = { workspace = true }

[dev-dependencies]
tokio = { workspace = true, features = ["rt", "macros", "rt-multi-thread"] }
5 changes: 2 additions & 3 deletions aries/messages/src/misc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ pub use mime_type::MimeType;
pub use shared::misc::{serde_ignored::SerdeIgnored as NoDecorators, utils::CowStr};

#[cfg(test)]

pub mod test_utils {
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
Expand All @@ -21,7 +20,7 @@ pub mod test_utils {

pub struct DateTimeRfc3339<'a>(pub &'a DateTime<Utc>);

impl<'a> Serialize for DateTimeRfc3339<'a> {
impl Serialize for DateTimeRfc3339<'_> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
Expand All @@ -32,7 +31,7 @@ pub mod test_utils {

pub struct OptDateTimeRfc3339<'a>(pub &'a Option<DateTime<Utc>>);

impl<'a> Serialize for OptDateTimeRfc3339<'a> {
impl Serialize for OptDateTimeRfc3339<'_> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ impl<'a> From<&'a CredentialPreviewV1MsgType> for CredentialIssuanceTypeV1_0 {
}
}

impl<'a> TryFrom<CowStr<'a>> for CredentialPreviewV1MsgType {
impl TryFrom<CowStr<'_>> for CredentialPreviewV1MsgType {
type Error = String;

fn try_from(value: CowStr) -> Result<Self, Self::Error> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl<'a> From<&'a CredentialPreviewV2MsgType> for CredentialIssuanceTypeV2_0 {
}
}

impl<'a> TryFrom<CowStr<'a>> for CredentialPreviewV2MsgType {
impl TryFrom<CowStr<'_>> for CredentialPreviewV2MsgType {
type Error = String;

fn try_from(value: CowStr) -> Result<Self, Self::Error> {
Expand Down
1 change: 0 additions & 1 deletion aries/messages/src/msg_fields/protocols/routing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pub struct ForwardContent {
into_msg_with_type!(Forward, RoutingTypeV1_0, Forward);

#[cfg(test)]

mod tests {
use serde_json::json;
// Bind `shared::misc::serde_ignored::SerdeIgnored` type as `NoDecorators`.
Expand Down
4 changes: 2 additions & 2 deletions aries/misc/indy_ledger_response_parser/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl ResponseParser {
GetNymReplyResult::GetNymReplyResultV0(res) => {
let data: GetNymResultDataV0 = res
.data
.ok_or_else(|| LedgerResponseParserError::LedgerItemNotFound("NYM"))
.ok_or(LedgerResponseParserError::LedgerItemNotFound("NYM"))
.and_then(|data| serde_json::from_str(&data).map_err(Into::into))?;

NymData {
Expand Down Expand Up @@ -192,7 +192,7 @@ impl ResponseParser {
let data = match reply.result() {
GetTxnAuthorAgreementResult::GetTxnAuthorAgreementResultV1(res) => res
.data
.ok_or_else(|| LedgerResponseParserError::LedgerItemNotFound("TAA"))?,
.ok_or(LedgerResponseParserError::LedgerItemNotFound("TAA"))?,
};

Ok(GetTxnAuthorAgreementData {
Expand Down
16 changes: 6 additions & 10 deletions aries/misc/legacy/diddoc_legacy/src/aries/diddoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ impl AriesDidDoc {
}

pub fn set_service_endpoint(&mut self, service_endpoint: Url) {
self.service.get_mut(0).map(|service| {
if let Some(service) = self.service.get_mut(0) {
service.service_endpoint = service_endpoint;
service
});
}
}

pub fn set_recipient_keys(&mut self, recipient_keys: Vec<String>) {
Expand All @@ -68,10 +67,9 @@ impl AriesDidDoc {
public_key: key_reference,
});

self.service.get_mut(0).map(|service| {
if let Some(service) = self.service.get_mut(0) {
service.recipient_keys.push(key_in_base58.clone());
service
});
}
});
}

Expand All @@ -91,10 +89,9 @@ impl AriesDidDoc {
// public_key_base_58: key.clone(),
// });

self.service.get_mut(0).map(|service| {
if let Some(service) = self.service.get_mut(0) {
service.routing_keys.push(key.to_string());
service
});
}
});
}

Expand Down Expand Up @@ -487,7 +484,6 @@ pub mod test_utils {
}

#[cfg(test)]

mod unit_tests {
use serde_json::json;

Expand Down
1 change: 0 additions & 1 deletion aries/misc/legacy/diddoc_legacy/src/w3c/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ impl Serialize for DdoKeyReference {
}

#[cfg(test)]

mod unit_test {
use crate::{aries::diddoc::test_utils::_did, w3c::model::DdoKeyReference};

Expand Down
1 change: 0 additions & 1 deletion aries/misc/shared/src/maybe_known.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ pub enum MaybeKnown<T, U = String> {
}

#[cfg(test)]

mod tests {
use serde::Deserialize;
use serde_json::json;
Expand Down
2 changes: 1 addition & 1 deletion aries/misc/test_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ indy-vdr-proxy-client = { workspace = true, optional = true }
lazy_static.workspace = true
serde_json.workspace = true
rand.workspace = true
uuid = { workspace = true, default-features = false, features = ["v4"] }
uuid = { workspace = true }
async-trait.workspace = true
chrono.workspace = true
env_logger.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions did_core/did_doc/src/schema/did_doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl DidDocument {
vm: &'a VerificationMethodKind,
id: &str,
) -> Option<&'a VerificationMethod> {
return match vm {
match vm {
VerificationMethodKind::Resolved(vm) => {
if vm.id().fragment() == Some(id) {
Some(vm)
Expand All @@ -110,7 +110,7 @@ impl DidDocument {
None
}
}
};
}
}

pub fn authentication_by_id(&self, id: &str) -> Option<&VerificationMethod> {
Expand Down
2 changes: 1 addition & 1 deletion did_core/did_methods/did_peer/src/peer_did/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl<'de, N: Numalgo> Deserialize<'de> for PeerDid<N> {
{
struct PeerDidVisitor<N: Numalgo>(PhantomData<N>);

impl<'de, N: Numalgo> Visitor<'de> for PeerDidVisitor<N> {
impl<N: Numalgo> Visitor<'_> for PeerDidVisitor<N> {
type Value = PeerDid<N>;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
Expand Down

0 comments on commit 1dd7389

Please sign in to comment.