Skip to content

Commit

Permalink
(chore) update to rust 1.79 (#1274)
Browse files Browse the repository at this point in the history
* update to rust 1.79 and remove warnings/errors

Signed-off-by: George Mulhearn <gmulhearn@anonyome.com>

* make clippy happy

Signed-off-by: George Mulhearn <gmulhearn@anonyome.com>

---------

Signed-off-by: George Mulhearn <gmulhearn@anonyome.com>
Co-authored-by: George Mulhearn <gmulhearn@anonyome.com>
  • Loading branch information
gmulhearn and gmulhearn-anonyome committed Jul 23, 2024
1 parent f9c07c9 commit 320b1ce
Show file tree
Hide file tree
Showing 20 changed files with 31 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ env:
DOCKER_REPO_LOCAL_VDRPROXY: vdrproxy
DOCKER_REPO_LOCAL_AATH: aath-backchannel

RUST_TOOLCHAIN_VERSION: 1.76.0
RUST_TOOLCHAIN_VERSION: 1.79.0
NODE_VERSION: 18.x

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mediator.pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env:
DOCKER_BUILDKIT: 1
MAIN_BRANCH: main

RUST_TOOLCHAIN_VERSION: 1.76.0
RUST_TOOLCHAIN_VERSION: 1.79.0

jobs:

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ There's 2 best way to reach us:
- We bump minor version on releases containing new features, significant refactors or breaking changes.
- We bump patch version if release only contains fixes or smaller refactoring.
- See [releases](https://github.com/hyperledger/aries-vcx/releases) page.
- Crates are known to be stable with atleast Rust version 1.79
2 changes: 1 addition & 1 deletion aries/agents/aath-backchannel/Dockerfile.aries-vcx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ RUN apk update && apk upgrade && \
USER aries
WORKDIR /home/aries

ARG RUST_VER="1.76.0"
ARG RUST_VER="1.79.0"
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUST_VER --default-host x86_64-unknown-linux-musl
ENV PATH="/home/aries/.cargo/bin:$PATH" RUSTFLAGS="-C target-feature=-crt-static"

Expand Down
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
14 changes: 0 additions & 14 deletions aries/aries_vcx/tests/utils/scenarios/connection.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
use aries_vcx::{
errors::error::VcxResult,
handlers::{out_of_band::sender::OutOfBandSender, util::AnyInvitation},
protocols::{
connection::{invitee::any_invitation_into_did_doc, Connection, GenericConnection},
mediated_connection::pairwise_info::PairwiseInfo,
},
transport::Transport,
};
use aries_vcx_anoncreds::anoncreds::base_anoncreds::BaseAnonCreds;
use aries_vcx_ledger::ledger::base_ledger::{
AnoncredsLedgerRead, AnoncredsLedgerWrite, IndyLedgerRead, IndyLedgerWrite,
};
use aries_vcx_wallet::wallet::base_wallet::BaseWallet;
use async_trait::async_trait;
use messages::{
msg_fields::protocols::{
connection::invitation::{Invitation, InvitationContent},
Expand All @@ -23,7 +20,6 @@ use messages::{
Protocol,
},
};
use url::Url;
use uuid::Uuid;

use crate::utils::test_agent::TestAgent;
Expand All @@ -44,16 +40,6 @@ async fn establish_connection_from_invite(
invitation: AnyInvitation,
inviter_pairwise_info: PairwiseInfo,
) -> (GenericConnection, GenericConnection) {
// TODO: Temporary, delete
struct DummyHttpClient;

#[async_trait]
impl Transport for DummyHttpClient {
async fn send_message(&self, _msg: Vec<u8>, _service_endpoint: &Url) -> VcxResult<()> {
Ok(())
}
}

let invitee_pairwise_info = PairwiseInfo::create(&alice.wallet).await.unwrap();
let invitee = Connection::new_invitee("".to_owned(), invitee_pairwise_info)
.accept_invitation(&alice.ledger_read, invitation.clone())
Expand Down
5 changes: 2 additions & 3 deletions aries/aries_vcx_anoncreds/src/utils/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ use serde_json::{Map, Value};

use crate::errors::error::{VcxAnoncredsError, VcxAnoncredsResult};

#[allow(unused)]
// some methods not used yet or by all features, but still a useful util
pub(crate) trait AsTypeOrDeserializationError {
fn try_as_str(&self) -> VcxAnoncredsResult<&str>;

fn try_as_object(&self) -> VcxAnoncredsResult<&Map<String, Value>>;
#[allow(dead_code)]
fn try_as_bool(&self) -> VcxAnoncredsResult<bool>;
#[allow(dead_code)]
fn try_as_array(&self) -> VcxAnoncredsResult<&Vec<Value>>;
}

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
2 changes: 2 additions & 0 deletions aries/misc/indy_ledger_response_parser/src/domain/attrib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ use indy_vdr::utils::did::ShortDidValue;

use super::response::GetReplyResultV1;

#[allow(unused)]
// unused for now, but domain defined: https://github.com/hyperledger/indy-node/blob/main/docs/source/transactions.md#attrib
#[derive(Debug, Deserialize)]
#[serde(untagged)]
pub enum GetAttrReplyResult {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ pub struct GetCredDefResultV0 {
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct GetCredDefResultDataV1 {
#[allow(unused)] // unused, but part of entity
pub ver: String,
pub id: CredentialDefinitionId,
#[serde(rename = "type")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::error::LedgerResponseParserError;
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct Response {
#[allow(unused)] // unused, but part of entity
pub req_id: u64,
pub reason: String,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ pub struct GetSchemaResultV0 {
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct GetSchemaResultDataV1 {
#[allow(unused)] // unused, but part of entity
pub ver: String,
pub id: SchemaId,
pub schema_name: 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
1 change: 1 addition & 0 deletions did_core/did_resolver_registry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ mod tests {

use super::*;

#[allow(unused)] // false positive. used for automock
struct DummyDidResolver;

#[async_trait]
Expand Down

0 comments on commit 320b1ce

Please sign in to comment.