chore: apply 1.84 linter suggestions (#5330)

* chore: apply 1.84 linter suggestions

* updated wasm dependencies to fix the macro issue

* second batch of clippy fixes
This commit is contained in:
Jędrzej Stuczyński
2025-01-10 14:00:18 +01:00
committed by GitHub
parent a94c035c0a
commit 529e8d49ee
16 changed files with 83 additions and 95 deletions
Generated
+27 -25
View File
@@ -2483,9 +2483,9 @@ checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7"
[[package]]
name = "fancy_constructor"
version = "1.2.2"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f71f317e4af73b2f8f608fac190c52eac4b1879d2145df1db2fe48881ca69435"
checksum = "07b19d0e43eae2bfbafe4931b5e79c73fb1a849ca15cd41a761a7b8587f9a1a2"
dependencies = [
"macroific",
"proc-macro2",
@@ -2846,15 +2846,15 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
[[package]]
name = "gloo-net"
version = "0.5.0"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43aaa242d1239a8822c15c645f02166398da4f8b5c4bae795c1f5b44e9eee173"
checksum = "c06f627b1a58ca3d42b45d6104bf1e1a03799df472df00988b6ba21accc10580"
dependencies = [
"futures-channel",
"futures-core",
"futures-sink",
"gloo-utils 0.2.0",
"http 0.2.12",
"http 1.1.0",
"js-sys",
"pin-project",
"serde",
@@ -3432,7 +3432,8 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683"
[[package]]
name = "indexed_db_futures"
version = "0.4.2"
source = "git+https://github.com/TiemenSch/rust-indexed-db?branch=update-uuid#9745d015707008b0c410115d787014a6d1af2efb"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0704b71f13f81b5933d791abf2de26b33c40935143985220299a357721166706"
dependencies = [
"accessory",
"cfg-if",
@@ -3670,10 +3671,11 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
[[package]]
name = "js-sys"
version = "0.3.72"
version = "0.3.76"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9"
checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7"
dependencies = [
"once_cell",
"wasm-bindgen",
]
@@ -10762,9 +10764,9 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b"
[[package]]
name = "wasm-bindgen"
version = "0.2.95"
version = "0.2.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e"
checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396"
dependencies = [
"cfg-if",
"once_cell",
@@ -10773,13 +10775,12 @@ dependencies = [
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.95"
version = "0.2.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358"
checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79"
dependencies = [
"bumpalo",
"log",
"once_cell",
"proc-macro2",
"quote",
"syn 2.0.90",
@@ -10788,21 +10789,22 @@ dependencies = [
[[package]]
name = "wasm-bindgen-futures"
version = "0.4.45"
version = "0.4.49"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b"
checksum = "38176d9b44ea84e9184eff0bc34cc167ed044f816accfe5922e54d84cf48eca2"
dependencies = [
"cfg-if",
"js-sys",
"once_cell",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.95"
version = "0.2.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56"
checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -10810,9 +10812,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.95"
version = "0.2.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68"
checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2"
dependencies = [
"proc-macro2",
"quote",
@@ -10823,9 +10825,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.95"
version = "0.2.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d"
checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6"
[[package]]
name = "wasm-bindgen-test"
@@ -10933,9 +10935,9 @@ dependencies = [
[[package]]
name = "wasmtimer"
version = "0.2.0"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f656cd8858a5164932d8a90f936700860976ec21eb00e0fe2aa8cab13f6b4cf"
checksum = "0048ad49a55b9deb3953841fa1fc5858f0efbcb7a18868c899a360269fac1b23"
dependencies = [
"futures",
"js-sys",
@@ -10947,9 +10949,9 @@ dependencies = [
[[package]]
name = "web-sys"
version = "0.3.72"
version = "0.3.76"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112"
checksum = "04dd7223427d52553d3702c004d3b2fe07c148165faa56313cb00211e31c12bc"
dependencies = [
"js-sys",
"wasm-bindgen",
+8 -10
View File
@@ -394,19 +394,17 @@ prost = { version = "0.12", default-features = false }
# wasm-related dependencies
gloo-utils = "0.2.0"
gloo-net = "0.5.0"
gloo-net = "0.6.0"
# use a separate branch due to feature unification failures
# this is blocked until the upstream removes outdates `wasm_bindgen` feature usage
# indexed_db_futures = "0.4.1"
indexed_db_futures = { git = "https://github.com/TiemenSch/rust-indexed-db", branch = "update-uuid" }
js-sys = "0.3.70"
# TODO: migrate to 0.6+
indexed_db_futures = "0.4.2"
js-sys = "0.3.76"
serde-wasm-bindgen = "0.6.5"
tsify = "0.4.5"
wasm-bindgen = "0.2.95"
wasm-bindgen-futures = "0.4.45"
wasmtimer = "0.2.0"
web-sys = "0.3.72"
wasm-bindgen = "0.2.99"
wasm-bindgen-futures = "0.4.49"
wasmtimer = "0.4.1"
web-sys = "0.3.76"
# Profile settings for individual crates
+1 -1
View File
@@ -190,7 +190,7 @@ where
Ok(GatewayWithLatency::new(gateway, avg))
}
pub async fn choose_gateway_by_latency<'a, R: Rng, G: ConnectableGateway + Clone>(
pub async fn choose_gateway_by_latency<R: Rng, G: ConnectableGateway + Clone>(
rng: &mut R,
gateways: &[G],
must_use_tls: bool,
@@ -9,7 +9,7 @@ use futures::{Sink, Stream};
use rand::{CryptoRng, RngCore};
use tungstenite::Message as WsMessage;
impl<'a, S, R> State<'a, S, R> {
impl<S, R> State<'_, S, R> {
async fn client_handshake_inner(&mut self) -> Result<(), HandshakeError>
where
S: Stream<Item = WsItem> + Sink<WsMessage> + Unpin,
@@ -10,7 +10,7 @@ use crate::registration::handshake::{error::HandshakeError, WsItem};
use futures::{Sink, Stream};
use tungstenite::Message as WsMessage;
impl<'a, S, R> State<'a, S, R> {
impl<S, R> State<'_, S, R> {
async fn gateway_handshake_inner(
&mut self,
raw_init_message: Vec<u8>,
@@ -115,10 +115,7 @@ pub fn aggregate_signatures(
let params = ecash_group_parameters();
// aggregate the signature
let signature = match Aggregatable::aggregate(signatures, indices) {
Ok(res) => res,
Err(err) => return Err(err),
};
let signature = Aggregatable::aggregate(signatures, indices)?;
// Ensure the aggregated signature is not an infinity point
if bool::from(signature.is_at_infinity()) {
@@ -428,7 +428,7 @@ impl PacketStatisticsControl {
while self
.history
.front()
.map_or(false, |&(t, _)| t < recording_window)
.is_some_and(|&(t, _)| t < recording_window)
{
self.history.pop_front();
}
@@ -462,7 +462,7 @@ impl PacketStatisticsControl {
while self
.rates
.front()
.map_or(false, |&(t, _)| t < recording_window)
.is_some_and(|&(t, _)| t < recording_window)
{
self.rates.pop_front();
}
+1 -3
View File
@@ -120,9 +120,7 @@ impl ThreadsafeGatewayCache {
.read()
.await
.get(&identity_key)
.map_or(false, |cache_item| {
cache_item.valid_until > SystemTime::now()
})
.is_some_and(|cache_item| cache_item.valid_until > SystemTime::now())
}
pub(crate) async fn get_locations(&self) -> GatewayLocationCache {
+1 -3
View File
@@ -106,9 +106,7 @@ impl ThreadsafeMixNodesCache {
.read()
.await
.get(&mix_id)
.map_or(false, |cache_item| {
cache_item.valid_until > SystemTime::now()
})
.is_some_and(|cache_item| cache_item.valid_until > SystemTime::now())
}
pub(crate) async fn get_locations(&self) -> MixnodeLocationCache {
+1 -3
View File
@@ -60,9 +60,7 @@ impl ThreadSafeNymNodesCache {
.read()
.await
.get(&node_id)
.map_or(false, |cache_item| {
cache_item.valid_until > SystemTime::now()
})
.is_some_and(|cache_item| cache_item.valid_until > SystemTime::now())
}
pub(crate) async fn get_bonded_nymnodes(
@@ -710,7 +710,7 @@ pub(crate) struct ChainWritePermit<'a> {
inner: RwLockWriteGuard<'a, DirectSigningHttpRpcNyxdClient>,
}
impl<'a> ChainWritePermit<'a> {
impl ChainWritePermit<'_> {
pub(crate) async fn make_deposits(
self,
short_sha: &'static str,
+2 -2
View File
@@ -6388,9 +6388,9 @@ checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1"
[[package]]
name = "wasmtimer"
version = "0.2.0"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f656cd8858a5164932d8a90f936700860976ec21eb00e0fe2aa8cab13f6b4cf"
checksum = "0048ad49a55b9deb3953841fa1fc5858f0efbcb7a18868c899a360269fac1b23"
dependencies = [
"futures",
"js-sys",
@@ -168,9 +168,9 @@ impl NetworkManager {
Ok(())
}
async fn validate_existing_contracts<'a>(
async fn validate_existing_contracts(
&self,
ctx: &DkgSkipCtx<'a>,
ctx: &DkgSkipCtx<'_>,
) -> Result<ContractCodeId, NetworkManagerError> {
ctx.println(format!(
"🔬 {}Validating the current DKG and group contracts...",
@@ -215,9 +215,9 @@ impl NetworkManager {
Ok(current_code)
}
async fn persist_dkg_keys<'a, P: AsRef<Path>>(
async fn persist_dkg_keys<P: AsRef<Path>>(
&self,
ctx: &mut DkgSkipCtx<'a>,
ctx: &mut DkgSkipCtx<'_>,
output_dir: P,
) -> Result<(), NetworkManagerError> {
ctx.println(format!(
@@ -272,9 +272,9 @@ impl NetworkManager {
Ok(())
}
async fn upload_bypass_contract<'a, P: AsRef<Path>>(
async fn upload_bypass_contract<P: AsRef<Path>>(
&self,
ctx: &DkgSkipCtx<'a>,
ctx: &DkgSkipCtx<'_>,
dkg_bypass_contract: P,
) -> Result<ContractCodeId, NetworkManagerError> {
ctx.println(format!(
@@ -297,9 +297,9 @@ impl NetworkManager {
Ok(res.code_id)
}
async fn migrate_to_bypass_contract<'a>(
async fn migrate_to_bypass_contract(
&self,
ctx: &DkgSkipCtx<'a>,
ctx: &DkgSkipCtx<'_>,
code_id: ContractCodeId,
) -> Result<(), NetworkManagerError> {
ctx.println(format!(
@@ -336,9 +336,9 @@ impl NetworkManager {
Ok(())
}
async fn restore_dkg_contract<'a>(
async fn restore_dkg_contract(
&self,
ctx: &DkgSkipCtx<'a>,
ctx: &DkgSkipCtx<'_>,
code_id: ContractCodeId,
) -> Result<(), NetworkManagerError> {
ctx.println(format!(
@@ -363,7 +363,7 @@ impl NetworkManager {
Ok(())
}
async fn add_group_members<'a>(&self, ctx: &DkgSkipCtx<'a>) -> Result<(), NetworkManagerError> {
async fn add_group_members(&self, ctx: &DkgSkipCtx<'_>) -> Result<(), NetworkManagerError> {
ctx.println(format!(
"👪 {}Adding all the cw4 group members...",
style("[7/8]").bold().dim()
@@ -387,9 +387,9 @@ impl NetworkManager {
Ok(())
}
async fn transfer_signer_tokens<'a>(
async fn transfer_signer_tokens(
&self,
ctx: &DkgSkipCtx<'a>,
ctx: &DkgSkipCtx<'_>,
) -> Result<(), NetworkManagerError> {
ctx.println(format!(
"💸 {}Transferring tokens to the new signers...",
@@ -67,9 +67,9 @@ impl NetworkManager {
.join(DEFAULT_CONFIG_FILENAME)
}
async fn initialise_api<'a>(
async fn initialise_api(
&self,
ctx: &LocalApisCtx<'a>,
ctx: &LocalApisCtx<'_>,
info: &EcashSignerWithPaths,
) -> Result<(), NetworkManagerError> {
let address = &info.data.cosmos_account.address;
@@ -139,7 +139,7 @@ impl NetworkManager {
Ok(())
}
async fn initialise_apis<'a>(&self, ctx: &LocalApisCtx<'a>) -> Result<(), NetworkManagerError> {
async fn initialise_apis(&self, ctx: &LocalApisCtx<'_>) -> Result<(), NetworkManagerError> {
ctx.println(format!(
"🔏 {}Initialising local nym-apis...",
style("[1/1]").bold().dim()
@@ -80,9 +80,9 @@ impl NetworkManager {
.join(DEFAULT_CONFIG_FILENAME)
}
async fn wait_for_api_gateway<'a>(
async fn wait_for_api_gateway(
&self,
ctx: &LocalClientCtx<'a>,
ctx: &LocalClientCtx<'_>,
) -> Result<SocketAddr, NetworkManagerError> {
// create api client
// hehe, that's disgusting, but it's not meant to be used by users
@@ -145,9 +145,9 @@ impl NetworkManager {
}
}
async fn wait_for_gateway_endpoint<'a>(
async fn wait_for_gateway_endpoint(
&self,
ctx: &LocalClientCtx<'a>,
ctx: &LocalClientCtx<'_>,
gateway: SocketAddr,
) -> Result<(), NetworkManagerError> {
ctx.set_pb_message(format!(
@@ -177,17 +177,14 @@ impl NetworkManager {
Ok(())
}
async fn wait_for_gateway<'a>(
&self,
ctx: &LocalClientCtx<'a>,
) -> Result<(), NetworkManagerError> {
async fn wait_for_gateway(&self, ctx: &LocalClientCtx<'_>) -> Result<(), NetworkManagerError> {
let endpoint = self.wait_for_api_gateway(ctx).await?;
self.wait_for_gateway_endpoint(ctx, endpoint).await
}
async fn prepare_nym_client<'a>(
async fn prepare_nym_client(
&self,
ctx: &LocalClientCtx<'a>,
ctx: &LocalClientCtx<'_>,
) -> Result<(), NetworkManagerError> {
ctx.println(format!(
"🔏 {}Initialising local nym-client...",
@@ -102,9 +102,9 @@ struct ReducedSignatureOut {
}
impl NetworkManager {
async fn initialise_nym_node<'a>(
async fn initialise_nym_node(
&self,
ctx: &mut LocalNodesCtx<'a>,
ctx: &mut LocalNodesCtx<'_>,
offset: u16,
is_gateway: bool,
) -> Result<(), NetworkManagerError> {
@@ -222,9 +222,9 @@ impl NetworkManager {
Ok(())
}
async fn initialise_nym_nodes<'a>(
async fn initialise_nym_nodes(
&self,
ctx: &mut LocalNodesCtx<'a>,
ctx: &mut LocalNodesCtx<'_>,
mixnodes: u16,
gateways: u16,
) -> Result<(), NetworkManagerError> {
@@ -250,9 +250,9 @@ impl NetworkManager {
Ok(())
}
async fn transfer_bonding_tokens<'a>(
async fn transfer_bonding_tokens(
&self,
ctx: &LocalNodesCtx<'a>,
ctx: &LocalNodesCtx<'_>,
) -> Result<(), NetworkManagerError> {
ctx.println(format!(
"💸 {}Transferring tokens to the bond owners...",
@@ -281,9 +281,9 @@ impl NetworkManager {
Ok(())
}
async fn bond_node<'a>(
async fn bond_node(
&self,
ctx: &LocalNodesCtx<'a>,
ctx: &LocalNodesCtx<'_>,
node: &NymNode,
is_gateway: bool,
) -> Result<(), NetworkManagerError> {
@@ -318,7 +318,7 @@ impl NetworkManager {
Ok(())
}
async fn bond_nym_nodes<'a>(&self, ctx: &LocalNodesCtx<'a>) -> Result<(), NetworkManagerError> {
async fn bond_nym_nodes(&self, ctx: &LocalNodesCtx<'_>) -> Result<(), NetworkManagerError> {
ctx.println(format!(
"⛓️ {}Bonding the local nym-nodes...",
style("[3/5]").bold().dim()
@@ -336,9 +336,9 @@ impl NetworkManager {
Ok(())
}
async fn assign_to_active_set<'a>(
async fn assign_to_active_set(
&self,
ctx: &LocalNodesCtx<'a>,
ctx: &LocalNodesCtx<'_>,
) -> Result<(), NetworkManagerError> {
ctx.println(format!(
"🔌 {}Assigning nodes to the active set...",
@@ -460,9 +460,9 @@ impl NetworkManager {
ctx.progress.output_run_commands(cmds)
}
async fn persist_nodes_in_database<'a>(
async fn persist_nodes_in_database(
&self,
ctx: &LocalNodesCtx<'a>,
ctx: &LocalNodesCtx<'_>,
) -> Result<(), NetworkManagerError> {
ctx.println(format!(
"📦 {}Storing the node information in the database",