Skip to content
Snippets Groups Projects
Commit 3f5e883b authored by Éloïs's avatar Éloïs
Browse files

[style] comply new clippy version

parent fde7cd13
Branches
Tags
1 merge request!130Ci
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "ansi_term"
version = "0.11.0"
......
......@@ -67,7 +67,7 @@ pub fn already_have_block(
} else if let Some(orphan_blockstamps) = forks_dbs.orphan_blocks_db.read(|db| {
if let Some(orphan_blocks) = db.get(&previous_blockstamp) {
let orphan_blockstamps: Vec<Blockstamp> =
orphan_blocks.iter().map(|b| b.blockstamp()).collect();
orphan_blocks.iter().map(DALBlock::blockstamp).collect();
Some(orphan_blockstamps)
} else {
None
......
......@@ -13,6 +13,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use crate::entities::fork_tree::ForkTree;
use crate::*;
use dubp_documents::*;
......@@ -32,7 +33,7 @@ pub fn insert_new_head_block(
fork_tree.insert_new_node(blockstamp, parent_id_opt, true);
})?;
Ok(fork_tree_db.read(|tree| tree.get_removed_blockstamps())?)
Ok(fork_tree_db.read(ForkTree::get_removed_blockstamps)?)
}
/// Insert new fork block in fork tree only if parent exist in fork tree (orphan block not inserted)
......@@ -72,7 +73,7 @@ pub fn change_main_branch(
let removed_blockstamps = forks_dbs
.fork_tree_db
.read(|tree| tree.get_removed_blockstamps())?;
.read(ForkTree::get_removed_blockstamps)?;
// Remove too old blocks
forks_dbs.fork_blocks_db.write(|db| {
......
......@@ -168,7 +168,7 @@ pub fn dbex_wot<DC: DuniterConf>(profile: &str, conf: &DC, csv: bool, query: &DB
// Get members count
let members_count = wot_db
.read(|db| db.get_enabled())
.read(WebOfTrust::get_enabled)
.expect("Fail to read WotDB")
.len();
......
......@@ -65,7 +65,7 @@ pub fn apply_valid_block<W: WebOfTrust>(
// Newcomer
let wot_id = NodeId(
wot_db
.read(|db| db.size())
.read(WebOfTrust::size)
.expect("Fatal error : fail to read WotDB !"),
);
wot_db
......@@ -195,7 +195,7 @@ pub fn apply_valid_block<W: WebOfTrust>(
if let Some(du_amount) = block.dividend {
if du_amount > 0 {
let members_wot_ids = wot_db
.read(|db| db.get_enabled())
.read(WebOfTrust::get_enabled)
.expect("Fail to read WotDB");
let mut members_pubkeys = Vec::new();
for (pubkey, wot_id) in wot_index {
......
......@@ -14,6 +14,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use dubp_documents::Blockstamp;
use durs_blockchain_dal::entities::fork_tree::ForkTree;
use durs_blockchain_dal::{DALError, ForksDBs};
use std::collections::HashSet;
......@@ -34,9 +35,7 @@ pub fn fork_resolution_algo(
.median_time
})?;
let mut sheets = forks_dbs
.fork_tree_db
.read(|fork_tree| fork_tree.get_sheets())?;
let mut sheets = forks_dbs.fork_tree_db.read(ForkTree::get_sheets)?;
sheets.sort_unstable_by(|s1, s2| s2.1.id.cmp(&s1.1.id));
......
......@@ -97,7 +97,7 @@ pub fn revert_block<W: WebOfTrust>(
if let Some(du_amount) = block.dividend {
if du_amount > 0 {
let members_wot_ids = wot_db
.read(|db| db.get_enabled())
.read(WebOfTrust::get_enabled)
.expect("Fail to read WotDB");
let mut members_pubkeys = Vec::new();
for (pubkey, wot_id) in wot_index.iter() {
......
......@@ -711,7 +711,7 @@ impl DursModule<DuRsConf, DursMsg> for WS2PModule {
WS2PSignal::Heads(ws2p_full_id, heads) => {
trace!("WS2PSignal::Heads({}, {:?})", ws2p_full_id, heads.len());
ws2p_module.send_dal_request(&BlockchainRequest::UIDs(
heads.iter().map(|h| h.pubkey()).collect(),
heads.iter().map(NetworkHead::pubkey).collect(),
));
ws2p_module.send_network_event(&NetworkEvent::ReceiveHeads(
heads
......
......@@ -37,7 +37,7 @@ pub fn _self_peer_update_endpoints(
false
}
})
.map(|ep| ep.api())
.map(EndpointEnum::api)
.collect();
let mut new_endpoints_bin = Vec::with_capacity(max_eps);
let mut new_endpoints_str = Vec::with_capacity(max_eps);
......
......@@ -199,7 +199,7 @@ impl PeerCardV11 {
algorithm: self.issuer.algo(),
pubkey: self.issuer.to_base58(),
blockstamp: self.blockstamp.to_string(),
endpoints: self.endpoints.iter().map(|ep| ep.to_string()).collect(),
endpoints: self.endpoints.iter().map(EndpointV2::to_string).collect(),
signature: if let Some(sig) = self.sig {
Some(sig.to_base64())
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment