From 3359b65ff03b31d596491d701db8b38c6427adb1 Mon Sep 17 00:00:00 2001 From: Surinder Singh Matoo Date: Fri, 6 Oct 2023 04:55:32 +0530 Subject: [PATCH] lint issues --- kos/src/imports.rs | 1 + rpc/grpc/client/src/route.rs | 1 - rpc/grpc/server/src/connection.rs | 10 ---------- wallet/core/src/settings.rs | 9 +++------ wallet/core/src/utxo/processor.rs | 2 +- 5 files changed, 5 insertions(+), 18 deletions(-) diff --git a/kos/src/imports.rs b/kos/src/imports.rs index 1a99d7b98..b82f370d7 100644 --- a/kos/src/imports.rs +++ b/kos/src/imports.rs @@ -1,3 +1,4 @@ +pub use crate::core::MetricsCtl; pub use crate::core::*; pub use crate::error::Error; pub use crate::ipc::*; diff --git a/rpc/grpc/client/src/route.rs b/rpc/grpc/client/src/route.rs index c0f20c244..c378039ea 100644 --- a/rpc/grpc/client/src/route.rs +++ b/rpc/grpc/client/src/route.rs @@ -22,7 +22,6 @@ macro_rules! route { return __ret; } let __self = self; - let request = request; let __ret: RpcResult<[<$name Response>]> = { __self.inner.call(RpcApiOps::$name, request).await?.as_ref().try_into() }; #[allow(unreachable_code)] diff --git a/rpc/grpc/server/src/connection.rs b/rpc/grpc/server/src/connection.rs index 1aa51505b..3cbf29e86 100644 --- a/rpc/grpc/server/src/connection.rs +++ b/rpc/grpc/server/src/connection.rs @@ -315,7 +315,6 @@ impl Connection { match payload { Payload::NotifyBlockAddedRequest(ref request) => match kaspa_rpc_core::NotifyBlockAddedRequest::try_from(request) { Ok(request) => { - let listener_id = listener_id; let result = notifier .clone() .execute_subscribe_command(listener_id, Scope::BlockAdded(BlockAddedScope::default()), request.command) @@ -328,7 +327,6 @@ impl Connection { Payload::NotifyVirtualChainChangedRequest(ref request) => { match kaspa_rpc_core::NotifyVirtualChainChangedRequest::try_from(request) { Ok(request) => { - let listener_id = listener_id; let result = notifier .clone() .execute_subscribe_command( @@ -348,7 +346,6 @@ impl Connection { Payload::NotifyFinalityConflictRequest(ref request) => { match kaspa_rpc_core::NotifyFinalityConflictRequest::try_from(request) { Ok(request) => { - let listener_id = listener_id; let result = notifier .clone() .execute_subscribe_command( @@ -376,7 +373,6 @@ impl Connection { Payload::NotifyUtxosChangedRequest(ref request) => { match kaspa_rpc_core::NotifyUtxosChangedRequest::try_from(request) { Ok(request) => { - let listener_id = listener_id; let result = notifier .clone() .execute_subscribe_command( @@ -394,7 +390,6 @@ impl Connection { Payload::NotifySinkBlueScoreChangedRequest(ref request) => { match kaspa_rpc_core::NotifySinkBlueScoreChangedRequest::try_from(request) { Ok(request) => { - let listener_id = listener_id; let result = notifier .clone() .execute_subscribe_command( @@ -412,7 +407,6 @@ impl Connection { Payload::NotifyVirtualDaaScoreChangedRequest(ref request) => { match kaspa_rpc_core::NotifyVirtualDaaScoreChangedRequest::try_from(request) { Ok(request) => { - let listener_id = listener_id; let result = notifier .clone() .execute_subscribe_command( @@ -430,7 +424,6 @@ impl Connection { Payload::NotifyPruningPointUtxoSetOverrideRequest(ref request) => { match kaspa_rpc_core::NotifyPruningPointUtxoSetOverrideRequest::try_from(request) { Ok(request) => { - let listener_id = listener_id; let result = notifier .clone() .execute_subscribe_command( @@ -448,7 +441,6 @@ impl Connection { Payload::NotifyNewBlockTemplateRequest(ref request) => { match kaspa_rpc_core::NotifyNewBlockTemplateRequest::try_from(request) { Ok(request) => { - let listener_id = listener_id; let result = notifier .clone() .execute_subscribe_command( @@ -468,7 +460,6 @@ impl Connection { let response: StopNotifyingUtxosChangedResponseMessage = match kaspa_rpc_core::NotifyUtxosChangedRequest::try_from(¬ify_request) { Ok(request) => { - let listener_id = listener_id; let result = notifier .clone() .execute_subscribe_command( @@ -489,7 +480,6 @@ impl Connection { let response: StopNotifyingPruningPointUtxoSetOverrideResponseMessage = match kaspa_rpc_core::NotifyPruningPointUtxoSetOverrideRequest::try_from(¬ify_request) { Ok(request) => { - let listener_id = listener_id; let result = notifier .clone() .execute_subscribe_command( diff --git a/wallet/core/src/settings.rs b/wallet/core/src/settings.rs index 4543d76d8..8174496f7 100644 --- a/wallet/core/src/settings.rs +++ b/wallet/core/src/settings.rs @@ -101,16 +101,13 @@ where None }; - let list = if list.is_none() { - Value::Object(Map::from_iter(::defaults().await.into_iter().map(|(k, v)| { + let list = + list.unwrap_or(Value::Object(Map::from_iter(::defaults().await.into_iter().map(|(k, v)| { let ks = to_value(k).unwrap(); let ks = ks.as_str().expect("Unable to convert key to string"); (ks.to_string(), v) - }))) - } else { - list.unwrap() - }; + })))); self.map.clear(); if let Value::Object(map) = list { diff --git a/wallet/core/src/utxo/processor.rs b/wallet/core/src/utxo/processor.rs index cc1766194..e317ef27f 100644 --- a/wallet/core/src/utxo/processor.rs +++ b/wallet/core/src/utxo/processor.rs @@ -70,7 +70,7 @@ pub struct UtxoProcessor { impl UtxoProcessor { pub fn new(rpc: Option, network_id: Option, multiplexer: Option>>) -> Self { - let multiplexer = multiplexer.unwrap_or_else(Multiplexer::new); + let multiplexer = multiplexer.unwrap_or_default(); UtxoProcessor { inner: Arc::new(Inner::new(rpc, network_id, multiplexer)) } }