parazyd пре 4 година
родитељ
комит
287302f4ec

+ 2 - 2
bin/ircd/src/irc_server.rs

@@ -32,7 +32,7 @@ pub struct IrcServerConnection {
     is_user_init: bool,
     is_registered: bool,
     nickname: String,
-    channels: Vec<String>,
+    _channels: Vec<String>,
 }
 
 impl IrcServerConnection {
@@ -47,7 +47,7 @@ impl IrcServerConnection {
             is_user_init: false,
             is_registered: false,
             nickname: "".to_string(),
-            channels: vec![],
+            _channels: vec![],
         }
     }
 

+ 4 - 7
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)
     }

+ 3 - 3
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<Arc<PrivMsg>>,

+ 7 - 1
bin/map/src/app.rs

@@ -69,7 +69,7 @@ impl App {
     //    Timer::after(dur).await;
     //}
 
-    pub async fn update(mut self, node_vec: Vec<NodeInfo>) -> App {
+    pub async fn update(self, node_vec: Vec<NodeInfo>) -> 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()
+    }
+}

+ 6 - 10
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<Executor<'_>>, mut app: App) -> Result<()> {
+async fn start(ex: Arc<Executor<'_>>, 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 {

+ 6 - 0
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);
 //}

+ 1 - 1
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);
 
     // =======

+ 2 - 2
src/node/service/gateway_p2p.rs

@@ -18,7 +18,7 @@ use crate::{
 pub struct Gateway {
     p2p: P2pPtr,
     slabstore: Arc<SlabStore>,
-    last_indexes: Arc<Mutex<Vec<u64>>>,
+    _last_indexes: Arc<Mutex<Vec<u64>>>,
 }
 
 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<Executor<'_>>) -> Result<()> {