From 05edfad13abc0b214528bada14896f8e354e7c63 Mon Sep 17 00:00:00 2001 From: Greg Fitzgerald Date: Tue, 26 Jun 2018 15:43:20 -0600 Subject: [PATCH] Fix compiler warnings --- src/choose_gossip_peer_strategy.rs | 10 +++++----- src/crdt.rs | 6 ++---- src/lib.rs | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/choose_gossip_peer_strategy.rs b/src/choose_gossip_peer_strategy.rs index 682ba08e42..dec6a0aee3 100644 --- a/src/choose_gossip_peer_strategy.rs +++ b/src/choose_gossip_peer_strategy.rs @@ -1,5 +1,5 @@ use crdt::ReplicatedData; -use rand::distributions::{IndependentSample, Weighted, WeightedChoice}; +use rand::distributions::{Distribution, Weighted, WeightedChoice}; use rand::thread_rng; use result::{Error, Result}; use signature::PublicKey; @@ -184,7 +184,7 @@ impl<'a> ChooseGossipPeerStrategy for ChooseWeightedPeerStrategy<'a> { } let mut rng = thread_rng(); - Ok(WeightedChoice::new(&mut weighted_peers).ind_sample(&mut rng)) + Ok(WeightedChoice::new(&mut weighted_peers).sample(&mut rng)) } } @@ -196,8 +196,8 @@ mod tests { use std; use std::collections::HashMap; - fn get_stake(id: PublicKey) -> f64 { - return 1.0; + fn get_stake(_id: PublicKey) -> f64 { + 1.0 } #[test] @@ -315,7 +315,7 @@ mod tests { remote.insert(key1, old_index); - for i in 0..num_peers { + for _i in 0..num_peers { let pk = KeyPair::new().pubkey(); rumors.insert(pk, old_index); } diff --git a/src/crdt.rs b/src/crdt.rs index cce92f017d..32c3383f50 100644 --- a/src/crdt.rs +++ b/src/crdt.rs @@ -15,9 +15,7 @@ use bincode::{deserialize, serialize}; use byteorder::{LittleEndian, ReadBytesExt}; -use choose_gossip_peer_strategy::{ - ChooseGossipPeerStrategy, ChooseRandomPeerStrategy, ChooseWeightedPeerStrategy, -}; +use choose_gossip_peer_strategy::{ChooseGossipPeerStrategy, ChooseWeightedPeerStrategy}; use hash::Hash; use packet::{to_blob, Blob, BlobRecycler, SharedBlob, BLOB_SIZE}; use pnet_datalink as datalink; @@ -491,7 +489,7 @@ impl Crdt { } // TODO: fill in with real implmentation once staking is implemented - fn get_stake(id: PublicKey) -> f64 { + fn get_stake(_id: PublicKey) -> f64 { 1.0 } diff --git a/src/lib.rs b/src/lib.rs index 7f17a0f66f..da04911dee 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,7 +13,7 @@ pub mod bank; pub mod banking_stage; pub mod blob_fetch_stage; pub mod budget; -mod choose_gossip_peer_strategy; +pub mod choose_gossip_peer_strategy; pub mod crdt; pub mod drone; pub mod entry;