Replace Arc with Rc on clippy's suggestion

This commit is contained in:
Jon Häggblad
2023-08-25 07:33:32 +02:00
parent 377c9be790
commit b050ae72de
2 changed files with 8 additions and 6 deletions
+4 -3
View File
@@ -1,6 +1,8 @@
// Copyright 2023 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use std::rc::Rc;
use crate::client::config::Config;
use crate::storage::error::ClientStorageError;
use js_sys::Promise;
@@ -8,7 +10,6 @@ use nym_client_core::client::base_client::storage::gateway_details::PersistedGat
use nym_crypto::asymmetric::{encryption, identity};
use nym_gateway_client::SharedKeys;
use nym_sphinx::acknowledgements::AckKey;
use std::sync::Arc;
use wasm_bindgen::prelude::*;
use wasm_bindgen_futures::future_to_promise;
use wasm_utils::storage::{IdbVersionChangeEvent, WasmStorage};
@@ -43,7 +44,7 @@ mod v1 {
pub struct ClientStorage {
#[allow(dead_code)]
pub(crate) name: String,
pub(crate) inner: Arc<WasmStorage>,
pub(crate) inner: Rc<WasmStorage>,
}
#[wasm_bindgen]
@@ -88,7 +89,7 @@ impl ClientStorage {
.await?;
Ok(ClientStorage {
inner: Arc::new(inner),
inner: Rc::new(inner),
name,
})
}
+4 -3
View File
@@ -29,6 +29,7 @@ use nym_validator_client::client::IdentityKey;
use nym_validator_client::QueryReqwestRpcNyxdClient;
use rand::rngs::OsRng;
use std::collections::HashSet;
use std::rc::Rc;
use std::sync::atomic::{AtomicBool, AtomicU32, Ordering};
use std::sync::{Arc, Mutex as SyncMutex};
use std::time::Duration;
@@ -42,7 +43,7 @@ pub(crate) mod helpers;
pub type NodeTestMessage = TestMessage<WasmTestMessageExt>;
type LockedGatewayClient =
Arc<AsyncMutex<GatewayClient<QueryReqwestRpcNyxdClient, EphemeralStorage>>>;
Rc<AsyncMutex<GatewayClient<QueryReqwestRpcNyxdClient, EphemeralStorage>>>;
pub(crate) const DEFAULT_TEST_TIMEOUT: Duration = Duration::from_secs(10);
pub(crate) const DEFAULT_TEST_PACKETS: u32 = 20;
@@ -210,7 +211,7 @@ impl NymNodeTesterBuilder {
test_in_progress: Arc::new(AtomicBool::new(false)),
current_test_nonce: Default::default(),
tester: Arc::new(SyncMutex::new(tester)),
gateway_client: Arc::new(AsyncMutex::new(gateway_client)),
gateway_client: Rc::new(AsyncMutex::new(gateway_client)),
processed_receiver: ReceivedReceiverWrapper::new(processed_receiver),
_task_manager: task_manager,
})
@@ -343,7 +344,7 @@ impl NymNodeTester {
));
let processed_receiver_clone = self.processed_receiver.clone();
let gateway_client_clone = Arc::clone(&self.gateway_client);
let gateway_client_clone = Rc::clone(&self.gateway_client);
let tester_marker = TestMarker::new(Arc::clone(&self.test_in_progress));
// start doing async things (send packets and watch for anything coming back)