Remove compilation warnings. (#2835)

* Remove compilation warnings.

* Allow unused only not in tests.

* Remove unnecessary mut.

* Make CI happy.

* Revert "Make CI happy."

This reverts commit abb865fe4b9fe9af1ae3ec801da9d4305ea35765.
This commit is contained in:
Tomasz Drwięga
2019-06-11 22:42:28 +02:00
committed by Bastian Köcher
parent ad2d958248
commit 6feab51069
5 changed files with 145 additions and 139 deletions
+7
View File
@@ -282,6 +282,10 @@ pub struct Peer<D, S: NetworkSpecialization<Block>> {
peer_id: PeerId,
client: PeersClient,
net_proto_channel: ProtocolChannel<S>,
/// This field is used only in test code, but maintaining different
/// instantiation paths or field names is too much hassle, hence
/// we allow it to be unused.
#[cfg_attr(not(test), allow(unused))]
protocol_status: Arc<RwLock<ProtocolStatus<Block>>>,
import_queue: Box<BasicQueue<Block>>,
pub data: D,
@@ -471,6 +475,7 @@ impl<D, S: NetworkSpecialization<Block>> Peer<D, S> {
self.net_proto_channel.send_from_client(ProtocolMsg::BlockImported(info.chain.best_hash, header));
}
#[cfg(test)]
fn on_block_imported(
&self,
hash: <Block as BlockT>::Hash,
@@ -492,6 +497,7 @@ impl<D, S: NetworkSpecialization<Block>> Peer<D, S> {
}
/// Get protocol status.
#[cfg(test)]
fn protocol_status(&self) -> ProtocolStatus<Block> {
self.protocol_status.read().clone()
}
@@ -608,6 +614,7 @@ impl<D, S: NetworkSpecialization<Block>> Peer<D, S> {
}
/// Announce a block to peers.
#[cfg(test)]
fn announce_block(&self, block: Hash) {
self.net_proto_channel.send_from_client(ProtocolMsg::AnnounceBlock(block));
}