From 9979e790aae8a149fdac692f03bb377c79c8648a Mon Sep 17 00:00:00 2001 From: Vladimir Komendantskiy Date: Mon, 16 Jul 2018 14:31:21 +0100 Subject: [PATCH] added must_use to tests and removed Clone from FaultLog --- src/fault_log.rs | 16 ++++++++-------- tests/agreement.rs | 1 + tests/broadcast.rs | 1 + tests/common_coin.rs | 1 + tests/common_subset.rs | 1 + tests/dynamic_honey_badger.rs | 1 + tests/honey_badger.rs | 1 + tests/queueing_honey_badger.rs | 1 + tests/sync_key_gen.rs | 1 + 9 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/fault_log.rs b/src/fault_log.rs index 9afe603..9b0cea5 100644 --- a/src/fault_log.rs +++ b/src/fault_log.rs @@ -42,13 +42,13 @@ pub enum FaultKind { /// A structure representing the context of a faulty node. This structure /// describes which node is faulty (`node_id`) and which faulty behavior /// that the node exhibited ('kind'). -#[derive(Clone, Debug, PartialEq)] -pub struct Fault { +#[derive(Debug, PartialEq)] +pub struct Fault { pub node_id: NodeUid, pub kind: FaultKind, } -impl Fault { +impl Fault { pub fn new(node_id: NodeUid, kind: FaultKind) -> Self { Fault { node_id, kind } } @@ -56,17 +56,17 @@ impl Fault { /// Creates a new `FaultLog` where `self` is the first element in the log /// vector. -impl Into> for Fault { +impl Into> for Fault { fn into(self) -> FaultLog { FaultLog(vec![self]) } } /// A structure used to contain reports of faulty node behavior. -#[derive(Clone, Debug, PartialEq)] -pub struct FaultLog(pub Vec>); +#[derive(Debug, PartialEq)] +pub struct FaultLog(pub Vec>); -impl FaultLog { +impl FaultLog { /// Creates an empty `FaultLog`. pub fn new() -> Self { FaultLog::default() @@ -98,7 +98,7 @@ impl FaultLog { } } -impl Default for FaultLog { +impl Default for FaultLog { fn default() -> Self { FaultLog(vec![]) } diff --git a/tests/agreement.rs b/tests/agreement.rs index ab9fd26..ad61612 100644 --- a/tests/agreement.rs +++ b/tests/agreement.rs @@ -1,3 +1,4 @@ +#![deny(unused_must_use)] //! Tests of the Binary Byzantine Agreement protocol. Only one proposer instance //! is tested. Each of the nodes in the simulated network run only one instance //! of Agreement. This way we only test correctness of the protocol and not diff --git a/tests/broadcast.rs b/tests/broadcast.rs index 8b8005d..e1eb1dd 100644 --- a/tests/broadcast.rs +++ b/tests/broadcast.rs @@ -1,3 +1,4 @@ +#![deny(unused_must_use)] //! Integration test of the reliable broadcast protocol. extern crate hbbft; diff --git a/tests/common_coin.rs b/tests/common_coin.rs index 23ab884..556992e 100644 --- a/tests/common_coin.rs +++ b/tests/common_coin.rs @@ -1,3 +1,4 @@ +#![deny(unused_must_use)] //! Common Coin tests extern crate env_logger; diff --git a/tests/common_subset.rs b/tests/common_subset.rs index 7af95c7..0f25683 100644 --- a/tests/common_subset.rs +++ b/tests/common_subset.rs @@ -1,3 +1,4 @@ +#![deny(unused_must_use)] //! Integration tests of the Asynchronous Common Subset protocol. extern crate env_logger; diff --git a/tests/dynamic_honey_badger.rs b/tests/dynamic_honey_badger.rs index 391e3ec..6ea3a75 100644 --- a/tests/dynamic_honey_badger.rs +++ b/tests/dynamic_honey_badger.rs @@ -1,3 +1,4 @@ +#![deny(unused_must_use)] //! Network tests for Dynamic Honey Badger. extern crate hbbft; diff --git a/tests/honey_badger.rs b/tests/honey_badger.rs index eee01ec..fc74ac3 100644 --- a/tests/honey_badger.rs +++ b/tests/honey_badger.rs @@ -1,3 +1,4 @@ +#![deny(unused_must_use)] //! Network tests for Honey Badger. extern crate bincode; diff --git a/tests/queueing_honey_badger.rs b/tests/queueing_honey_badger.rs index 13f987c..316b08e 100644 --- a/tests/queueing_honey_badger.rs +++ b/tests/queueing_honey_badger.rs @@ -1,3 +1,4 @@ +#![deny(unused_must_use)] //! Network tests for Queueing Honey Badger. extern crate env_logger; diff --git a/tests/sync_key_gen.rs b/tests/sync_key_gen.rs index 406339f..8392300 100644 --- a/tests/sync_key_gen.rs +++ b/tests/sync_key_gen.rs @@ -1,3 +1,4 @@ +#![deny(unused_must_use)] //! Tests for synchronous distributed key generation. extern crate env_logger;