Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: apply 1.84 linter suggestions #5330

Merged
merged 3 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 27 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 8 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion common/client-core/src/init/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand Down
5 changes: 1 addition & 4 deletions common/nym_offline_compact_ecash/src/scheme/aggregation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
4 changes: 2 additions & 2 deletions common/statistics/src/clients/packet_statistics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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();
}
Expand Down
4 changes: 1 addition & 3 deletions explorer-api/src/gateways/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 1 addition & 3 deletions explorer-api/src/mix_nodes/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 1 addition & 3 deletions explorer-api/src/unstable/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions nym-wallet/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions tools/internal/testnet-manager/src/manager/dkg_skip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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...",
Expand Down Expand Up @@ -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!(
Expand Down Expand Up @@ -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!(
Expand All @@ -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!(
Expand Down Expand Up @@ -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!(
Expand All @@ -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()
Expand All @@ -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...",
Expand Down
6 changes: 3 additions & 3 deletions tools/internal/testnet-manager/src/manager/local_apis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
Expand Down
Loading
Loading