Skip to content

Commit

Permalink
make clippy happy
Browse files Browse the repository at this point in the history
Signed-off-by: George Mulhearn <[email protected]>
  • Loading branch information
gmulhearn-anonyome committed Jul 23, 2024
1 parent b27ff91 commit 81e721a
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 20 deletions.
10 changes: 4 additions & 6 deletions aries/aries_vcx/src/common/proofs/prover/prover_internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub async fn build_schemas_json_prover(
let mut rtn: SchemasMap = HashMap::new();

for cred_info in credentials_identifiers {
if rtn.get(&cred_info.schema_id).is_none() {
if !rtn.contains_key(&cred_info.schema_id) {
let schema_json = ledger
.get_schema(&cred_info.schema_id, None)
.await
Expand Down Expand Up @@ -157,7 +157,7 @@ pub async fn build_rev_states_json(
&cred_info.cred_rev_id,
&cred_info.tails_dir,
) {
if rtn.get(rev_reg_id).is_none() {
if !rtn.contains_key(rev_reg_id) {
// Does this make sense in case cred_info's for same rev_reg_ids have different
// revocation intervals
let (from, to) = if let Some(ref interval) = cred_info.revocation_interval {
Expand Down Expand Up @@ -226,8 +226,7 @@ pub fn build_requested_credentials_json(
if proof_req
.value()
.requested_attributes
.get(&cred_info.referent)
.is_some()
.contains_key(&cred_info.referent)
{
rtn.requested_attributes.insert(
cred_info.referent.to_owned(),
Expand All @@ -244,8 +243,7 @@ pub fn build_requested_credentials_json(
if proof_req
.value()
.requested_predicates
.get(&cred_info.referent)
.is_some()
.contains_key(&cred_info.referent)
{
rtn.requested_predicates.insert(
cred_info.referent.to_owned(),
Expand Down
4 changes: 2 additions & 2 deletions aries/aries_vcx/src/protocols/connection/generic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ mod connection_serde_tests {
let wallet = MockWallet;
let con = make_invitee_requested().await;
let mut con_data = ConnectionData::new(PW_KEY.to_owned(), AriesDidDoc::default());
con_data.did_doc.id = PW_KEY.to_owned();
PW_KEY.clone_into(&mut con_data.did_doc.id);
con_data.did_doc.set_recipient_keys(vec![PW_KEY.to_owned()]);
con_data.did_doc.set_routing_keys(Vec::new());

Expand Down Expand Up @@ -476,7 +476,7 @@ mod connection_serde_tests {
let new_routing_keys = vec![];

let mut con_data = ConnectionData::new(PW_KEY.to_owned(), AriesDidDoc::default());
con_data.did_doc.id = PW_KEY.to_owned();
PW_KEY.clone_into(&mut con_data.did_doc.id);
con_data.did_doc.set_recipient_keys(vec![PW_KEY.to_owned()]);
con_data.did_doc.set_routing_keys(Vec::new());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,12 @@ impl HolderSM {
let state = match self.state {
HolderFullState::Initial(_) => {
let mut proposal = proposal;
proposal.id = self.thread_id.clone();
proposal.id.clone_from(&self.thread_id);
HolderFullState::ProposalSet(ProposalSetState::new(proposal))
}
HolderFullState::OfferReceived(_) => {
let mut proposal = proposal;
proposal.id = self.thread_id.clone();
proposal.id.clone_from(&self.thread_id);
HolderFullState::ProposalSet(ProposalSetState::new(proposal))
}
s => {
Expand Down
2 changes: 1 addition & 1 deletion aries/aries_vcx/src/utils/encryption_envelope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ impl EncryptionEnvelope {
data =
EncryptionEnvelope::wrap_into_forward(wallet, data, &forward_to_key, routing_key)
.await?;
forward_to_key = routing_key.clone();
forward_to_key.clone_from(routing_key);
}
Ok(data)
}
Expand Down
5 changes: 1 addition & 4 deletions aries/aries_vcx_ledger/src/ledger/indy_vdr_ledger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -693,10 +693,7 @@ pub struct VcxPoolConfig {
pub fn build_ledger_components(
pool_config: VcxPoolConfig,
) -> VcxLedgerResult<(DefaultIndyLedgerRead, DefaultIndyLedgerWrite)> {
let indy_vdr_config = match pool_config.indy_vdr_config {
None => PoolConfig::default(),
Some(cfg) => cfg,
};
let indy_vdr_config = pool_config.indy_vdr_config.unwrap_or_default();
let cache_config = match pool_config.response_cache_config {
None => InMemoryResponseCacherConfig::builder()
.ttl(std::time::Duration::from_secs(60))
Expand Down
1 change: 1 addition & 0 deletions aries/misc/anoncreds_types/src/utils/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ where
}
}

#[allow(clippy::to_string_trait_impl)] // mimicks upstream anoncreds-rs, allow this to avoid divergence
impl string::ToString for Query {
fn to_string(&self) -> String {
self.to_value().to_string()
Expand Down
3 changes: 2 additions & 1 deletion aries/misc/legacy/libvdrtools/indy-utils/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![allow(clippy::not_unsafe_ptr_arg_deref)]
// allow all clippy warnings, given this is legacy to be removed soon
#![allow(clippy::all)]
#[macro_use]
extern crate serde_json;

Expand Down
2 changes: 2 additions & 0 deletions aries/misc/legacy/libvdrtools/indy-wallet/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// allow all clippy warnings, given this is legacy to be removed soon
#![allow(clippy::all)]
use std::{
collections::{HashMap, HashSet},
fmt, fs,
Expand Down
8 changes: 4 additions & 4 deletions aries/misc/test_utils/src/devsetup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ pub mod vdrtools_wallet;

const DEFAULT_AML_LABEL: &str = "eula";

pub fn write_file<P: AsRef<Path>>(file: P, content: &str) -> TestUtilsResult<()>
where
P: std::convert::AsRef<std::ffi::OsStr>,
{
pub fn write_file<P: AsRef<Path> + AsRef<std::ffi::OsStr>>(
file: P,
content: &str,
) -> TestUtilsResult<()> {
let path = PathBuf::from(&file);

if let Some(parent_path) = path.parent() {
Expand Down

0 comments on commit 81e721a

Please sign in to comment.