diff --git a/bin/ircd/src/irc_server.rs b/bin/ircd/src/irc_server.rs index 7ec65be0e..6c8da535b 100644 --- a/bin/ircd/src/irc_server.rs +++ b/bin/ircd/src/irc_server.rs @@ -32,7 +32,7 @@ pub struct IrcServerConnection { is_user_init: bool, is_registered: bool, nickname: String, - channels: Vec, + _channels: Vec, } impl IrcServerConnection { @@ -47,7 +47,7 @@ impl IrcServerConnection { is_user_init: false, is_registered: false, nickname: "".to_string(), - channels: vec![], + _channels: vec![], } } diff --git a/bin/ircd/src/main.rs b/bin/ircd/src/main.rs index 16f44d428..fbc3c8dab 100644 --- a/bin/ircd/src/main.rs +++ b/bin/ircd/src/main.rs @@ -16,13 +16,10 @@ use std::{ use darkfi::{ net, rpc::{ - jsonrpc::{ - error as jsonerr, request as jsonreq, response as jsonresp, ErrorCode::*, JsonRequest, - JsonResult, - }, + jsonrpc::{error as jsonerr, response as jsonresp, ErrorCode::*, JsonRequest, JsonResult}, rpcserver::{listen_and_serve, RequestHandler, RpcServerConfig}, }, - util::{expand_path, sleep}, + util::expand_path, Error, Result, }; @@ -33,7 +30,7 @@ mod protocol_privmsg; use crate::{ irc_server::IrcServerConnection, - privmsg::{PrivMsg, PrivMsgId, SeenPrivMsgIds, SeenPrivMsgIdsPtr}, + privmsg::{PrivMsg, SeenPrivMsgIds, SeenPrivMsgIdsPtr}, program_options::ProgramOptions, protocol_privmsg::ProtocolPrivMsg, }; @@ -83,7 +80,7 @@ async fn process_user_input( connection: &mut IrcServerConnection, p2p: net::P2pPtr, ) -> Result<()> { - if line.len() == 0 { + if line.is_empty() { warn!("Received empty line from {}. Closing connection.", peer_addr); return Err(Error::ChannelStopped) } diff --git a/bin/ircd/src/protocol_privmsg.rs b/bin/ircd/src/protocol_privmsg.rs index 7fbbb7f0f..315042ac8 100644 --- a/bin/ircd/src/protocol_privmsg.rs +++ b/bin/ircd/src/protocol_privmsg.rs @@ -1,10 +1,10 @@ use async_executor::Executor; -use async_std::sync::Mutex; + use darkfi::{net, Result}; use log::debug; -use std::{collections::HashSet, sync::Arc}; +use std::sync::Arc; -use crate::privmsg::{PrivMsg, PrivMsgId, SeenPrivMsgIdsPtr}; +use crate::privmsg::{PrivMsg, SeenPrivMsgIdsPtr}; pub struct ProtocolPrivMsg { notify_queue_sender: async_channel::Sender>, diff --git a/bin/map/src/app.rs b/bin/map/src/app.rs index c70e33111..c9dc34ac0 100644 --- a/bin/map/src/app.rs +++ b/bin/map/src/app.rs @@ -69,7 +69,7 @@ impl App { // Timer::after(dur).await; //} - pub async fn update(mut self, node_vec: Vec) -> App { + pub async fn update(self, node_vec: Vec) -> App { let node_info = NodeInfoView::new(node_vec.clone()); let ids = vec![node_vec[0].id.clone(), node_vec[1].id.clone(), node_vec[2].id.clone()]; @@ -78,3 +78,9 @@ impl App { App { node_list, node_info } } } + +impl Default for App { + fn default() -> Self { + Self::new() + } +} diff --git a/bin/map/src/main.rs b/bin/map/src/main.rs index cf867e09c..aa0657c82 100644 --- a/bin/map/src/main.rs +++ b/bin/map/src/main.rs @@ -20,11 +20,7 @@ use tui::{ Terminal, }; -use map::{ - list::NodeIdList, - node_info::{NodeInfo, NodeInfoView}, - ui, App, -}; +use map::{node_info::NodeInfo, ui, App}; struct Map { url: String, @@ -105,18 +101,18 @@ async fn main() -> Result<()> { result } -async fn start(ex: Arc>, mut app: App) -> Result<()> { +async fn start(ex: Arc>, app: App) -> Result<()> { let client = Map::new("tcp://127.0.0.1:8000".to_string()); ex.spawn(async { - poll(client, app).await; + let _ = poll(client, app).await; }) .detach(); Ok(()) } -async fn poll(client: Map, mut app: App) -> Result<()> { +async fn poll(client: Map, app: App) -> Result<()> { loop { let reply = client.get_info().await?; update(app.clone(), reply).await?; @@ -124,14 +120,14 @@ async fn poll(client: Map, mut app: App) -> Result<()> { } } -async fn update(mut app: App, reply: Value) -> Result<()> { +async fn update(app: App, reply: Value) -> Result<()> { if reply.as_object().is_some() && !reply.as_object().unwrap().is_empty() { //let args = params.as_array(); let nodes = reply.as_object().unwrap().get("nodes").unwrap(); let node1 = &nodes[0]; let node2 = &nodes[1]; - let node3 = &nodes[2]; + let _node3 = &nodes[2]; let infos = vec![ NodeInfo { diff --git a/bin/map/src/node_info.rs b/bin/map/src/node_info.rs index 92019294c..f6a1f7137 100644 --- a/bin/map/src/node_info.rs +++ b/bin/map/src/node_info.rs @@ -40,6 +40,12 @@ impl NodeInfo { } } +impl Default for NodeInfo { + fn default() -> Self { + Self::new() + } +} + //pub async fn add_seen(&self, id: u32) { // self.privmsg_ids.lock().await.insert(id); //} diff --git a/example/vm.rs b/example/vm.rs index 139193243..128cbea8b 100644 --- a/example/vm.rs +++ b/example/vm.rs @@ -78,7 +78,7 @@ fn mint_proof() -> Result<()> { info!("Prover setup: [{:?}]", Instant::now() - start); let start = Instant::now(); - let proof = Proof::create(&proving_key, &[circuit], &public_inputs.clone())?; + let proof = Proof::create(&proving_key, &[circuit], &public_inputs)?; info!("Prover prove: [{:?}]", Instant::now() - start); // ======= diff --git a/src/node/service/gateway_p2p.rs b/src/node/service/gateway_p2p.rs index d2b5138e7..fab8c09e4 100644 --- a/src/node/service/gateway_p2p.rs +++ b/src/node/service/gateway_p2p.rs @@ -18,7 +18,7 @@ use crate::{ pub struct Gateway { p2p: P2pPtr, slabstore: Arc, - last_indexes: Arc>>, + _last_indexes: Arc>>, } impl Gateway { @@ -28,7 +28,7 @@ impl Gateway { let p2p = P2p::new(settings); let last_indexes = Arc::new(Mutex::new(vec![0; 10])); - Ok(Self { p2p, slabstore, last_indexes }) + Ok(Self { p2p, slabstore, _last_indexes: last_indexes }) } pub async fn start(&self, executor: Arc>) -> Result<()> {