From cd1ff0673de29db6aa21cee35321800f3a1478c9 Mon Sep 17 00:00:00 2001
From: librelois <elois@ifee.fr>
Date: Mon, 14 May 2018 22:38:26 +0200
Subject: [PATCH] clippy
---
blockchain/lib.rs | 10 +++++-----
conf/lib.rs | 6 +++---
network/lib.rs | 22 +++++++++++-----------
network/network_head.rs | 4 ++--
4 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/blockchain/lib.rs b/blockchain/lib.rs
index 211c9ed4..d8464129 100644
--- a/blockchain/lib.rs
+++ b/blockchain/lib.rs
@@ -301,24 +301,24 @@ impl BlockchainModule {
}*/
}
&NetworkDocument::Identity(ref doc) => blockchain_documents.push(
- BlockchainProtocol::V10(Box::new(V10Document::Identity(doc.clone()))),
+ BlockchainProtocol::V10(Box::new(V10Document::Identity(doc.deref().clone()))),
),
&NetworkDocument::Membership(ref doc) => blockchain_documents.push(
- BlockchainProtocol::V10(Box::new(V10Document::Membership(doc.clone()))),
+ BlockchainProtocol::V10(Box::new(V10Document::Membership(doc.deref().clone()))),
),
&NetworkDocument::Certification(ref doc) => {
blockchain_documents.push(BlockchainProtocol::V10(Box::new(
- V10Document::Certification(Box::new(doc.clone())),
+ V10Document::Certification(Box::new(doc.deref().clone())),
)))
}
&NetworkDocument::Revocation(ref doc) => {
blockchain_documents.push(BlockchainProtocol::V10(Box::new(
- V10Document::Revocation(Box::new(doc.clone())),
+ V10Document::Revocation(Box::new(doc.deref().clone())),
)))
}
&NetworkDocument::Transaction(ref doc) => {
blockchain_documents.push(BlockchainProtocol::V10(Box::new(
- V10Document::Transaction(Box::new(doc.clone())),
+ V10Document::Transaction(Box::new(doc.deref().clone())),
)))
}
}
diff --git a/conf/lib.rs b/conf/lib.rs
index bf941893..a9a1def4 100644
--- a/conf/lib.rs
+++ b/conf/lib.rs
@@ -302,8 +302,8 @@ pub fn write_keypairs_file(
/// Save configuration in profile folder
pub fn write_conf_file(file_path: &PathBuf, conf: &DuniterConf) -> Result<(), std::io::Error> {
- match conf {
- &DuniterConf::V1(ref conf_v1) => {
+ match *conf {
+ DuniterConf::V1(ref conf_v1) => {
let mut f = try!(File::create(file_path.as_path()));
try!(
f.write_all(
@@ -314,7 +314,7 @@ pub fn write_conf_file(file_path: &PathBuf, conf: &DuniterConf) -> Result<(), st
);
try!(f.sync_all());
}
- &_ => {
+ _ => {
panic!("Fatal error : Conf version is not supported !");
}
}
diff --git a/network/lib.rs b/network/lib.rs
index e2036661..d02928b9 100644
--- a/network/lib.rs
+++ b/network/lib.rs
@@ -133,8 +133,8 @@ pub enum NetworkBlock {
impl NetworkBlock {
/// Return blockstamp
pub fn blockstamp(&self) -> Blockstamp {
- match self {
- &NetworkBlock::V10(ref network_block_v10) => {
+ match *self {
+ NetworkBlock::V10(ref network_block_v10) => {
network_block_v10.deref().uncompleted_block_doc.blockstamp()
}
_ => panic!("Block version not supported !"),
@@ -142,8 +142,8 @@ impl NetworkBlock {
}
/// Return previous blockstamp
pub fn previous_blockstamp(&self) -> Blockstamp {
- match self {
- &NetworkBlock::V10(ref network_block_v10) => Blockstamp {
+ match *self {
+ NetworkBlock::V10(ref network_block_v10) => Blockstamp {
id: BlockId(network_block_v10.deref().uncompleted_block_doc.number.0 - 1),
hash: BlockHash(
network_block_v10
@@ -163,15 +163,15 @@ pub enum NetworkDocument {
/// Network Block
Block(NetworkBlock),
/// Identity Document
- Identity(IdentityDocument),
+ Identity(Box<IdentityDocument>),
/// Membership Document
- Membership(MembershipDocument),
+ Membership(Box<MembershipDocument>),
/// Certification Document
- Certification(CertificationDocument),
+ Certification(Box<CertificationDocument>),
/// Revocation Document
- Revocation(RevocationDocument),
+ Revocation(Box<RevocationDocument>),
/// Transaction Document
- Transaction(TransactionDocument),
+ Transaction(Box<TransactionDocument>),
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
@@ -210,7 +210,7 @@ impl NetworkRequest {
| NetworkRequest::GetRequirementsPending(ref req_id, _, _)
| NetworkRequest::GetConsensus(ref req_id)
| NetworkRequest::GetHeadsCache(ref req_id)
- | NetworkRequest::GetEndpoints(ref req_id) => req_id.clone(),
+ | NetworkRequest::GetEndpoints(ref req_id) => *req_id,
}
}
/// Get request identitifier
@@ -258,7 +258,7 @@ impl NetworkResponse {
| NetworkResponse::Chunk(ref req_id, _, _)
| NetworkResponse::PendingDocuments(ref req_id, _)
| NetworkResponse::Consensus(ref req_id, _)
- | NetworkResponse::HeadsCache(ref req_id, _) => req_id.clone(),
+ | NetworkResponse::HeadsCache(ref req_id, _) => *req_id,
}
}
/// Get request identifier
diff --git a/network/network_head.rs b/network/network_head.rs
index 8559dbf3..5be4beb3 100644
--- a/network/network_head.rs
+++ b/network/network_head.rs
@@ -126,7 +126,7 @@ impl NetworkHeadMessageV2 {
api = short_api,
)
} else {
- format!("Term width insufficient")
+ String::from("Term width insufficient")
}
}
}
@@ -284,7 +284,7 @@ impl NetworkHeadV2 {
.to_human_string(max_len - 2, self.uid.clone())
)
} else {
- format!(".")
+ String::from(".")
}
}
/// Get uid of head issuer
--
GitLab