Commit 0194e94c authored by Éloïs's avatar Éloïs

[ci] comply latest clippy version

parent ec68025b
......@@ -166,6 +166,15 @@ dependencies = [
"cfg-if 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "dirs"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "dtoa"
version = "0.4.2"
......@@ -175,6 +184,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "duniter-blockchain"
version = "0.1.0-a0.1"
dependencies = [
"dirs 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"duniter-conf 0.1.0-a0.1",
"duniter-crypto 0.2.0-a0.1",
"duniter-dal 0.1.0-a0.1",
......@@ -199,6 +209,7 @@ dependencies = [
name = "duniter-conf"
version = "0.1.0-a0.1"
dependencies = [
"dirs 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"duniter-crypto 0.2.0-a0.1",
"duniter-module 0.1.0-a0.1",
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -212,6 +223,7 @@ name = "duniter-core"
version = "0.1.0-a0.1"
dependencies = [
"clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)",
"dirs 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"duniter-blockchain 0.1.0-a0.1",
"duniter-conf 0.1.0-a0.1",
"duniter-crypto 0.2.0-a0.1",
......@@ -1134,6 +1146,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3"
"checksum crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "927121f5407de9956180ff5e936fe3cf4324279280001cd56b669d28ee7e9150"
"checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9"
"checksum dirs 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "37a76dd8b997af7107d0bb69d43903cf37153a18266f8b3fdb9911f28efb5444"
"checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab"
"checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0"
"checksum failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "934799b6c1de475a012a02dab0ace1ace43789ee4b99bcfbf1a2e3e8ced5de82"
......
......@@ -9,6 +9,7 @@ license = "AGPL-3.0"
path = "lib.rs"
[dependencies]
dirs = "1.0.2"
duniter-conf = { path = "../conf" }
duniter-crypto = { path = "../crypto" }
duniter-dal = { path = "../dal" }
......
......@@ -16,7 +16,10 @@
//! Module managing the Duniter blockchain.
#![cfg_attr(feature = "strict", deny(warnings))]
#![cfg_attr(feature = "cargo-clippy", allow(unused_collect, duration_subsec))]
#![cfg_attr(
feature = "cargo-clippy",
allow(unused_collect, duration_subsec)
)]
#![deny(
missing_docs,
missing_debug_implementations,
......@@ -32,6 +35,7 @@
#[macro_use]
extern crate log;
extern crate dirs;
extern crate duniter_conf;
extern crate duniter_crypto;
extern crate duniter_dal;
......@@ -53,7 +57,6 @@ mod sync;
mod ts_parsers;
use std::collections::HashMap;
use std::env;
use std::fmt::Debug;
use std::ops::Deref;
use std::path::PathBuf;
......@@ -210,11 +213,11 @@ impl BlockchainModule {
verif_inner_hash: bool,
) {
// get db_ts_path
let mut db_ts_path = match env::home_dir() {
let mut db_ts_path = match dirs::config_dir() {
Some(path) => path,
None => panic!("Impossible to get your home dir!"),
None => panic!("Impossible to get user config directory !"),
};
db_ts_path.push(".config/duniter/");
db_ts_path.push("duniter/");
db_ts_path.push(ts_profile);
db_ts_path.push("duniter.db");
if !db_ts_path.as_path().exists() {
......
......@@ -13,6 +13,7 @@ rand = "0.4.*"
serde = "1.0.*"
serde_derive = "1.0.*"
serde_json = "1.0.*"
dirs = "1.0.2"
duniter-crypto = { path = "../crypto" }
duniter-module = { path = "../module" }
......
......@@ -34,6 +34,7 @@ extern crate serde_derive;
#[macro_use]
extern crate serde_json;
extern crate dirs;
extern crate duniter_crypto;
extern crate duniter_module;
extern crate rand;
......@@ -43,7 +44,6 @@ use duniter_module::{Currency, DuniterConf, ModuleId, RequiredKeys, RequiredKeys
use rand::Rng;
use serde::ser::{Serialize, SerializeStruct, Serializer};
use std::collections::HashSet;
use std::env;
use std::fs;
use std::fs::File;
use std::io::prelude::*;
......@@ -277,14 +277,10 @@ pub fn datas_path(profile: &str, currency: &Currency) -> PathBuf {
/// Returns the path to the folder containing the user data of the running profile
pub fn get_profile_path(profile: &str) -> PathBuf {
// Define and create datas directory if not exist
let mut profile_path = match env::home_dir() {
let mut profile_path = match dirs::config_dir() {
Some(path) => path,
None => panic!("Impossible to get your home dir !"),
None => panic!("Impossible to get user config directory !"),
};
profile_path.push(".config/");
if !profile_path.as_path().exists() {
fs::create_dir(profile_path.as_path()).expect("Impossible to create ~/.config dir !");
}
profile_path.push(USER_DATAS_FOLDER);
if !profile_path.as_path().exists() {
fs::create_dir(profile_path.as_path()).unwrap_or_else(|_| {
......@@ -431,11 +427,10 @@ pub fn get_blockchain_db_path(profile: &str, currency: &Currency) -> PathBuf {
/// Returns the path to the binary file containing the state of the web of trust
pub fn get_wot_path(profile: String, currency: &Currency) -> PathBuf {
let mut wot_path = match env::home_dir() {
let mut wot_path = match dirs::config_dir() {
Some(path) => path,
None => panic!("Impossible to get your home dir!"),
};
wot_path.push(".config/");
wot_path.push(USER_DATAS_FOLDER);
wot_path.push(profile);
wot_path.push(currency.to_string());
......
......@@ -10,6 +10,7 @@ path = "lib.rs"
[dependencies]
clap = {version = "2.31.2", features = ["yaml"]}
dirs = "1.0.2"
duniter-blockchain = { path = "../blockchain" }
duniter-conf = { path = "../conf" }
duniter-crypto = { path = "../crypto" }
......
......@@ -35,6 +35,7 @@ extern crate clap;
#[macro_use]
extern crate log;
extern crate dirs;
extern crate duniter_blockchain;
extern crate duniter_conf;
extern crate duniter_crypto;
......@@ -58,7 +59,6 @@ use duniter_network::{NetworkModule, SyncEndpoint};
use log::Level;
use simplelog::*;
use std::collections::HashSet;
use std::env;
use std::fs;
use std::fs::{File, OpenOptions};
use std::sync::mpsc;
......@@ -283,9 +283,9 @@ impl DuniterCore<DuRsConf> {
}
None
} else if let Some(matches) = cli_args.subcommand_matches("reset") {
let mut profile_path = match env::home_dir() {
let mut profile_path = match dirs::config_dir() {
Some(path) => path,
None => panic!("Impossible to get your home dir !"),
None => panic!("Impossible to get user config directory !"),
};
profile_path.push(".config");
profile_path.push(duniter_conf::get_user_datas_folder());
......@@ -685,9 +685,9 @@ pub fn dbex<DC: DuniterConf>(profile: &str, conf: &DC, csv: bool, query: &DBExQu
/// Initialize logger
pub fn init_logger(profile: &str, soft_name: &'static str, cli_args: &ArgMatches) {
// Get datas folder path
let mut log_file_path = match env::home_dir() {
let mut log_file_path = match dirs::config_dir() {
Some(path) => path,
None => panic!("Fatal error : Impossible to get your home dir!"),
None => panic!("Fatal error : Impossible to get user config directory"),
};
log_file_path.push(".config");
if !log_file_path.as_path().exists() {
......
......@@ -80,7 +80,7 @@ pub enum DALResPendings {
/// All pending identities without their pending certifications
AllPendingIdentitiesWithoutCerts(HashMap<Hash, PendingIdtyDatas>),
/// All pending datas for given pubkey
PendingWotDatasForPubkey(PendingIdtyDatas),
PendingWotDatasForPubkey(Box<PendingIdtyDatas>),
}
#[derive(Debug, Clone)]
......@@ -102,5 +102,5 @@ pub enum DALResponse {
/// Response to a DALReqBlockchain request
Blockchain(Box<DALResBlockchain>),
/// Response to a DALReqPendings request
Pendings(ModuleReqFullId, DALResPendings),
Pendings(ModuleReqFullId, Box<DALResPendings>),
}
......@@ -52,24 +52,22 @@ pub fn get_sentry_requirement(members_count: usize, step_max: u32) -> u32 {
9
} else if members_count < 100_001 {
10
} else if members_count < 100_001 {
11
} else if members_count < 161_052 {
12
11
} else if members_count < 248_833 {
13
12
} else if members_count < 371_294 {
14
13
} else if members_count < 537_825 {
15
14
} else if members_count < 759_376 {
16
15
} else if members_count < 1_048_577 {
17
16
} else if members_count < 1_419_858 {
18
17
} else if members_count < 1_889_569 {
19
18
} else {
panic!(
"get_sentry_requirement not define for members_count greater than 1_889_569 !"
......
......@@ -17,6 +17,7 @@
//! 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,
......
......@@ -17,8 +17,14 @@
#![cfg_attr(feature = "strict", deny(warnings))]
#![deny(
missing_docs, missing_debug_implementations, missing_copy_implementations, trivial_casts,
trivial_numeric_casts, unsafe_code, unstable_features, unused_import_braces,
missing_docs,
missing_debug_implementations,
missing_copy_implementations,
trivial_casts,
trivial_numeric_casts,
unsafe_code,
unstable_features,
unused_import_braces,
unused_qualifications
)]
......
......@@ -28,8 +28,14 @@
#![cfg_attr(feature = "strict", deny(warnings))]
#![deny(
missing_docs, missing_debug_implementations, missing_copy_implementations, trivial_casts,
trivial_numeric_casts, unsafe_code, unstable_features, unused_import_braces,
missing_docs,
missing_debug_implementations,
missing_copy_implementations,
trivial_casts,
trivial_numeric_casts,
unsafe_code,
unstable_features,
unused_import_braces,
unused_qualifications
)]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment