Răsfoiți Sursa

Minor clipply cleanups.

parazyd 4 ani în urmă
părinte
comite
e8e7af759c

+ 1 - 1
bin/darkfid2/src/rpc_tx.rs

@@ -43,7 +43,7 @@ impl Darkfid {
         let address = params[2].as_str().unwrap();
         let amount = params[3].as_f64().unwrap();
 
-        if *self.synced.lock().await == false {
+        if !(*self.synced.lock().await) {
             error!("transfer(): Blockchain is not yet synced");
             return server_error(RpcError::NotYetSynced, id)
         }

+ 1 - 1
bin/faucetd/src/main.rs

@@ -284,7 +284,7 @@ async fn prune_airdrop_map(map: Arc<Mutex<HashMap<Address, i64>>>, timeout: i64)
         let im_map = map.lock().await;
         for (k, v) in im_map.iter() {
             if now - *v > timeout {
-                prune.push(k.clone());
+                prune.push(k);
             }
         }
         drop(im_map);

+ 1 - 1
src/blockchain/blockstore.rs

@@ -152,7 +152,7 @@ impl BlockOrderStore {
                 key = u64::from_be_bytes(key_bytes);
                 let block_hash = deserialize(&found.1)?;
                 ret.push(block_hash);
-                counter = counter + 1;
+                counter += 1;
             } else {
                 break
             }

+ 3 - 3
src/consensus/state.rs

@@ -462,7 +462,7 @@ impl ValidatorState {
             Some(mut chain) => {
                 debug!("Proposal to fork a forkchain was received.");
                 chain.proposals.pop(); // removing last block to create the fork
-                if chain.proposals.len() > 0 {
+                if !chain.proposals.len.is_empty() {
                     // if len is 0 we will verify against blockchain last block
                     self.consensus.proposals.push(chain);
                     return Ok(self.consensus.proposals.len() as i64 - 1)
@@ -799,7 +799,7 @@ impl ValidatorState {
         if self.consensus.participants.is_empty() {
             // If no nodes are active, node becomes a single node network.
             let participant = Participant::new(self.address, self.current_epoch());
-            self.consensus.participants.insert(participant.address, participant.clone());
+            self.consensus.participants.insert(participant.address, participant);
         }
 
         self.consensus.refreshed = epoch;
@@ -834,7 +834,7 @@ impl ValidatorState {
     /// return a vector of [`StateUpdate`]
     pub fn validate_state_transitions(state: MemoryState, txs: &[Tx]) -> Result<Vec<StateUpdate>> {
         let mut ret = vec![];
-        let mut st = state.clone();
+        let mut st = state;
 
         for (i, tx) in txs.iter().enumerate() {
             let update = match state_transition(&st, tx.0.clone()) {