diff --git a/blockchain/dbex.rs b/blockchain/dbex.rs index 33d263e0e68ec24f09654efd91c1d90a0080e62d..5ee9908efa21706be19c766f7133d724c608710e 100644 --- a/blockchain/dbex.rs +++ b/blockchain/dbex.rs @@ -73,7 +73,7 @@ pub fn dbex_tx<DC: DuniterConf>(profile: &str, conf: &DC, _csv: bool, query: &DB println!( "Databases loaded in {}.{:03} seconds.", load_dbs_duration.as_secs(), - load_dbs_duration.subsec_nanos() / 1_000_000 + load_dbs_duration.subsec_millis() ); let req_process_begin = SystemTime::now(); match *query { @@ -112,7 +112,7 @@ pub fn dbex_tx<DC: DuniterConf>(profile: &str, conf: &DC, _csv: bool, query: &DB println!( "Request processed in {}.{:06} seconds.", req_process_duration.as_secs(), - req_process_duration.subsec_nanos() / 1_000 + req_process_duration.subsec_micros() ); } @@ -131,7 +131,7 @@ pub fn dbex_wot<DC: DuniterConf>(profile: &str, conf: &DC, csv: bool, query: &DB println!( "Databases loaded in {}.{:03} seconds.", load_dbs_duration.as_secs(), - load_dbs_duration.subsec_nanos() / 1_000_000 + load_dbs_duration.subsec_millis() ); // Get currency parameters @@ -221,7 +221,7 @@ pub fn dbex_wot<DC: DuniterConf>(profile: &str, conf: &DC, csv: bool, query: &DB println!( "compute_distances_duration = {},{:03}.", compute_distances_duration.as_secs(), - compute_distances_duration.subsec_nanos() / 1_000_000 + compute_distances_duration.subsec_millis() ); } DBExWotQuery::ExpireMembers(ref reverse) => { diff --git a/blockchain/lib.rs b/blockchain/lib.rs index ceee9ae85b74e813c106fef147099497eb1b875a..82d44187b27d3de253e29bb74e21e4736c33b9a8 100644 --- a/blockchain/lib.rs +++ b/blockchain/lib.rs @@ -16,7 +16,7 @@ //! Module managing the Duniter blockchain. #![cfg_attr(feature = "strict", deny(warnings))] -#![cfg_attr(feature = "cargo-clippy", allow(duration_subsec))] +//#![cfg_attr(feature = "cargo-clippy", allow(duration_subsec))] #![deny( missing_docs, missing_debug_implementations, @@ -572,14 +572,15 @@ impl BlockchainModule { match blockchain_receiver.recv_timeout(Duration::from_millis(1000)) { Ok(ref message) => { match (*message).1 { - DursMsgContent::Request(ref request) => match request.content { - DursReqContent::DALRequest(ref dal_request) => match *dal_request { - DALRequest::BlockchainRequest(ref blockchain_req) => { - match *blockchain_req { - DALReqBlockchain::CurrentBlock() => { - debug!("BlockchainModule : receive DALReqBc::CurrentBlock()"); + DursMsgContent::Request(ref request) => { + if let DursReqContent::DALRequest(ref dal_request) = request.content { + match dal_request { + DALRequest::BlockchainRequest(ref blockchain_req) => { + match *blockchain_req { + DALReqBlockchain::CurrentBlock() => { + debug!("BlockchainModule : receive DALReqBc::CurrentBlock()"); - if let Some(current_block) = + if let Some(current_block) = DALBlock::get_block( &self.blocks_databases.blockchain_db, None, @@ -598,9 +599,9 @@ impl BlockchainModule { } else { warn!("BlockchainModule : Req : fail to get current_block in bdd !"); } - } - DALReqBlockchain::UIDs(ref pubkeys) => { - self.send_req_response(DursMsgReceiver::One(request.requester), &DALResponse::Blockchain(Box::new( + } + DALReqBlockchain::UIDs(ref pubkeys) => { + self.send_req_response(DursMsgReceiver::One(request.requester), &DALResponse::Blockchain(Box::new( DALResBlockchain::UIDs( request.id, pubkeys @@ -615,14 +616,14 @@ impl BlockchainModule { .collect(), ), ))); + } + _ => {} } - _ => {} } + DALRequest::PendingsRequest(ref _pending_req) => {} } - DALRequest::PendingsRequest(ref _pending_req) => {} - }, - _ => {} - }, + } + } DursMsgContent::NetworkEvent(ref network_event) => match *network_event { NetworkEvent::ReceiveDocuments(ref network_docs) => { let new_current_blockstamp = self.receive_network_documents( diff --git a/blockchain/sync.rs b/blockchain/sync.rs index df6578e5b7e88296b451403d07d4349f0f78daac..1bcd942b4a3c49c6809676b3f6c5474c38cc4471 100644 --- a/blockchain/sync.rs +++ b/blockchain/sync.rs @@ -234,7 +234,7 @@ pub fn sync_ts<DC: DuniterConf>( info!( "ts_job_duration={},{:03} seconds.", ts_job_duration.as_secs(), - ts_job_duration.subsec_nanos() / 1_000_000 + ts_job_duration.subsec_millis() ); }); @@ -387,7 +387,7 @@ pub fn sync_ts<DC: DuniterConf>( info!( "blocks_job_duration={},{:03} seconds.", blocks_job_duration.as_secs(), - blocks_job_duration.subsec_nanos() / 1_000_000 + blocks_job_duration.subsec_millis() ); }); @@ -429,7 +429,7 @@ pub fn sync_ts<DC: DuniterConf>( info!( "wot_job_duration={},{:03} seconds.", wot_job_duration.as_secs(), - wot_job_duration.subsec_nanos() / 1_000_000 + wot_job_duration.subsec_millis() ); }); @@ -466,7 +466,7 @@ pub fn sync_ts<DC: DuniterConf>( info!( "tx_job_duration={},{:03} seconds.", tx_job_duration.as_secs(), - tx_job_duration.subsec_nanos() / 1_000_000 + tx_job_duration.subsec_millis() ); }); let main_job_begin = SystemTime::now(); @@ -631,17 +631,17 @@ pub fn sync_ts<DC: DuniterConf>( info!( "main_job_duration={},{:03} seconds.", main_job_duration.as_secs(), - main_job_duration.subsec_nanos() / 1_000_000 + main_job_duration.subsec_millis() ); info!( "all_complete_block_duration={},{:03} seconds.", all_complete_block_duration.as_secs(), - all_complete_block_duration.subsec_nanos() / 1_000_000 + all_complete_block_duration.subsec_millis() ); info!( "all_apply_valid_block_duration={},{:03} seconds.", all_apply_valid_block_duration.as_secs(), - all_apply_valid_block_duration.subsec_nanos() / 1_000_000 + all_apply_valid_block_duration.subsec_millis() ); // Wait recv two finish signals @@ -662,12 +662,12 @@ pub fn sync_ts<DC: DuniterConf>( "Sync {} blocks in {}.{:03} seconds.", current_blockstamp.id.0 + 1, sync_duration.as_secs(), - sync_duration.subsec_nanos() / 1_000_000, + sync_duration.subsec_millis(), ); info!( "Sync {} blocks in {}.{:03} seconds.", current_blockstamp.id.0 + 1, sync_duration.as_secs(), - sync_duration.subsec_nanos() / 1_000_000, + sync_duration.subsec_millis(), ); } diff --git a/core/lib.rs b/core/lib.rs index b7a859673639d8286c8bbc0c16aa39099b6386b8..9f46712eec87d3a2cc0820aeaaac14559dec2d6d 100644 --- a/core/lib.rs +++ b/core/lib.rs @@ -16,7 +16,7 @@ //! Crate containing Duniter-rust core. #![cfg_attr(feature = "strict", deny(warnings))] -#![cfg_attr(feature = "cargo-clippy", allow(implicit_hasher))] +//#![cfg_attr(feature = "cargo-clippy", allow(implicit_hasher))] #![deny( missing_docs, missing_copy_implementations, @@ -531,7 +531,7 @@ impl<'a, 'b: 'a> DuniterCore<'b, 'a, DuRsConf> { } } if let Some(UserCommand::ListModules(ref options)) = self.user_command { - if module_valid_filters::<DuRsConf, DursMsg, M>( + if module_valid_filters::<DuRsConf, DursMsg, M, std::collections::hash_map::RandomState>( &self.soft_meta_datas.conf, &options.get_filters(), is_network_module, diff --git a/crypto/keys/ed25519.rs b/crypto/keys/ed25519.rs index 752cd5701de0c506531a65e105736f40a92d545f..a3dda669133b7f03147d929af4571d75211d9488 100644 --- a/crypto/keys/ed25519.rs +++ b/crypto/keys/ed25519.rs @@ -66,11 +66,11 @@ impl<'de> Deserialize<'de> for Signature { where D: Deserializer<'de>, { - struct ArrayVisitor<u8> { + struct ArrayVisitor { element: PhantomData<u8>, } - impl<'de, u8> Visitor<'de> for ArrayVisitor<u8> { + impl<'de> Visitor<'de> for ArrayVisitor { type Value = Signature; fn expecting(&self, formatter: &mut Formatter) -> fmt::Result { @@ -91,7 +91,7 @@ impl<'de> Deserialize<'de> for Signature { } } - let visitor: ArrayVisitor<u8> = ArrayVisitor { + let visitor: ArrayVisitor = ArrayVisitor { element: PhantomData, }; deserializer.deserialize_tuple(64, visitor) diff --git a/crypto/lib.rs b/crypto/lib.rs index 3620eb994bb08f6ec328d1e3aa412e0b2418d565..c478012c6ae72a63dad28079f775c0bccaf3a2f7 100644 --- a/crypto/lib.rs +++ b/crypto/lib.rs @@ -16,7 +16,6 @@ //! Provide wrappers for cryptographic building blocks used by Duniter. #![cfg_attr(feature = "strict", deny(warnings))] -#![cfg_attr(feature = "cargo-clippy", allow(builtin_type_shadow))] #![deny( missing_docs, missing_debug_implementations, diff --git a/dal/lib.rs b/dal/lib.rs index d7c837568b80907c8b6786a76c9e01934ab8e166..853442a607d310b8b10a2445ec0b2aa986d4d414 100644 --- a/dal/lib.rs +++ b/dal/lib.rs @@ -16,7 +16,7 @@ //! Datas Access Layer #![cfg_attr(feature = "strict", deny(warnings))] -#![cfg_attr(feature = "cargo-clippy", allow(implicit_hasher))] +//#![cfg_attr(feature = "cargo-clippy", allow(implicit_hasher))] #![cfg_attr(feature = "exp", allow(warnings))] #![deny( missing_docs, diff --git a/module/lib.rs b/module/lib.rs index b5ec9d1c1a64197aa134a3c3dd1853be4cd8ec68..009c00acb55eb5cf4c9db8db54dbf851fbc5e37d 100644 --- a/module/lib.rs +++ b/module/lib.rs @@ -17,7 +17,6 @@ //! as well as the DuniterModule trait that all modules must implement. #![cfg_attr(feature = "strict", deny(warnings))] -#![cfg_attr(feature = "cargo-clippy", allow(implicit_hasher))] #![deny( missing_docs, missing_debug_implementations, @@ -288,9 +287,14 @@ pub enum ModulesFilter { } /// Returns true only if the module checks all filters -pub fn module_valid_filters<DC: DuniterConf, Mess: ModuleMessage, M: DuniterModule<DC, Mess>>( +pub fn module_valid_filters< + DC: DuniterConf, + Mess: ModuleMessage, + M: DuniterModule<DC, Mess>, + S: ::std::hash::BuildHasher, +>( conf: &DC, - filters: &HashSet<ModulesFilter>, + filters: &HashSet<ModulesFilter, S>, network_module: bool, ) -> bool { if filters.contains(&ModulesFilter::Network()) && !network_module { diff --git a/ws2p-messages/lib.rs b/ws2p-messages/lib.rs index 1f156894283c8de2a680e82b3e8f69c21f6712e7..1588f275e38dd34b9485c3882b096dee74deb6c8 100644 --- a/ws2p-messages/lib.rs +++ b/ws2p-messages/lib.rs @@ -177,7 +177,7 @@ mod tests { ed25519::PublicKey::from_base58("4tNQ7d9pj2Da5wUVoW9mFn7JjuPoowF977au8DdhEjVR") .unwrap(), ), - target: target, + target, block_number: blockstamp.id, signature: sig, } diff --git a/ws2p-v1-legacy/clippy.toml b/ws2p-v1-legacy/clippy.toml new file mode 100644 index 0000000000000000000000000000000000000000..e02f006add50da81398cc2451bd748c47c7bdf9d --- /dev/null +++ b/ws2p-v1-legacy/clippy.toml @@ -0,0 +1 @@ +cyclomatic-complexity-threshold = 75 \ No newline at end of file diff --git a/ws2p-v1-legacy/lib.rs b/ws2p-v1-legacy/lib.rs index 774b327043b1119ccf509714bce17d431aecfdaa..8cb51d201479890a1242383585c7bb774e6c2f7b 100644 --- a/ws2p-v1-legacy/lib.rs +++ b/ws2p-v1-legacy/lib.rs @@ -16,7 +16,6 @@ //! WebSocketToPeer API for the Duniter project. #![cfg_attr(feature = "strict", deny(warnings))] -#![cfg_attr(feature = "cargo-clippy", allow(cyclomatic_complexity))] #![deny( missing_debug_implementations, missing_copy_implementations,