diff --git a/blockchain/lib.rs b/blockchain/lib.rs index 211c9ed4f3014e4b0b7b04bbe8b958a919efd0a9..d8464129521ce468ff91856bb7ae4ae9b3d6354d 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 bf9418935d82573c95b1e01eee48b32a81e5eece..a9a1def4ba4353153c1a6915ef0541339ac045fe 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 e20366615812c1322992196a843c3e1ac6461d62..d02928b921cb78a28098fc8fe8860c6ecccafb1f 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 8559dbf3734e29f405cbb19645c422b244d62aa3..5be4beb3dd9da97748d450d6e0da039bff3b6457 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