added must_use to tests and removed Clone from FaultLog

This commit is contained in:
Vladimir Komendantskiy 2018-07-16 14:31:21 +01:00
parent 22195c4b93
commit 9979e790aa
9 changed files with 16 additions and 8 deletions

View File

@ -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<NodeUid: Clone> {
#[derive(Debug, PartialEq)]
pub struct Fault<NodeUid> {
pub node_id: NodeUid,
pub kind: FaultKind,
}
impl<NodeUid: Clone> Fault<NodeUid> {
impl<NodeUid> Fault<NodeUid> {
pub fn new(node_id: NodeUid, kind: FaultKind) -> Self {
Fault { node_id, kind }
}
@ -56,17 +56,17 @@ impl<NodeUid: Clone> Fault<NodeUid> {
/// Creates a new `FaultLog` where `self` is the first element in the log
/// vector.
impl<NodeUid: Clone> Into<FaultLog<NodeUid>> for Fault<NodeUid> {
impl<NodeUid> Into<FaultLog<NodeUid>> for Fault<NodeUid> {
fn into(self) -> FaultLog<NodeUid> {
FaultLog(vec![self])
}
}
/// A structure used to contain reports of faulty node behavior.
#[derive(Clone, Debug, PartialEq)]
pub struct FaultLog<NodeUid: Clone>(pub Vec<Fault<NodeUid>>);
#[derive(Debug, PartialEq)]
pub struct FaultLog<NodeUid>(pub Vec<Fault<NodeUid>>);
impl<NodeUid: Clone> FaultLog<NodeUid> {
impl<NodeUid> FaultLog<NodeUid> {
/// Creates an empty `FaultLog`.
pub fn new() -> Self {
FaultLog::default()
@ -98,7 +98,7 @@ impl<NodeUid: Clone> FaultLog<NodeUid> {
}
}
impl<NodeUid: Clone> Default for FaultLog<NodeUid> {
impl<NodeUid> Default for FaultLog<NodeUid> {
fn default() -> Self {
FaultLog(vec![])
}

View File

@ -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

View File

@ -1,3 +1,4 @@
#![deny(unused_must_use)]
//! Integration test of the reliable broadcast protocol.
extern crate hbbft;

View File

@ -1,3 +1,4 @@
#![deny(unused_must_use)]
//! Common Coin tests
extern crate env_logger;

View File

@ -1,3 +1,4 @@
#![deny(unused_must_use)]
//! Integration tests of the Asynchronous Common Subset protocol.
extern crate env_logger;

View File

@ -1,3 +1,4 @@
#![deny(unused_must_use)]
//! Network tests for Dynamic Honey Badger.
extern crate hbbft;

View File

@ -1,3 +1,4 @@
#![deny(unused_must_use)]
//! Network tests for Honey Badger.
extern crate bincode;

View File

@ -1,3 +1,4 @@
#![deny(unused_must_use)]
//! Network tests for Queueing Honey Badger.
extern crate env_logger;

View File

@ -1,3 +1,4 @@
#![deny(unused_must_use)]
//! Tests for synchronous distributed key generation.
extern crate env_logger;