Commit 6ceea600 authored by Éloïs's avatar Éloïs

[ref] rust 2018: remove useless extern crate

parent c3219f6a
...@@ -4,6 +4,7 @@ version = "0.1.0-a1" ...@@ -4,6 +4,7 @@ version = "0.1.0-a1"
authors = ["librelois <elois@duniter.org>","nanocryk <nanocryk@duniter.org>","inso <inso@tuta.io>"] authors = ["librelois <elois@duniter.org>","nanocryk <nanocryk@duniter.org>","inso <inso@tuta.io>"]
description = "DURS (Dividende Universel RuSt) is a new implementation of Duniter protocol and software in Rust, a safe, concurrent, practical language" description = "DURS (Dividende Universel RuSt) is a new implementation of Duniter protocol and software in Rust, a safe, concurrent, practical language"
license = "AGPL-3.0" license = "AGPL-3.0"
edition = "2018"
[dependencies] [dependencies]
duniter-core = { path = "../../lib/core/core" } duniter-core = { path = "../../lib/core/core" }
......
...@@ -28,17 +28,8 @@ ...@@ -28,17 +28,8 @@
unused_qualifications unused_qualifications
)] )]
#[macro_use] pub use duniter_core::cli::DursOpt;
extern crate duniter_core; pub use duniter_core::*;
#[cfg(unix)]
extern crate durs_tui;
//extern crate durs_skeleton;
extern crate durs_ws2p_v1_legacy;
//extern crate durs_ws2p;
extern crate structopt;
pub use duniter_core::{cli::DursOpt, DuRsConf, DuniterCore, UserCommand};
#[cfg(unix)] #[cfg(unix)]
pub use durs_tui::TuiModule; pub use durs_tui::TuiModule;
//pub use durs_skeleton::SkeletonModule; //pub use durs_skeleton::SkeletonModule;
......
...@@ -286,21 +286,17 @@ Vous pouvez modifier une copie de la ligne du module skeleton pour être sûr de ...@@ -286,21 +286,17 @@ Vous pouvez modifier une copie de la ligne du module skeleton pour être sûr de
Une fois que vous avez ajouter votre module en dépendance dans le Carego.toml de `durs-server`, il vas falloir utiliser votre module dans le main.rs : Une fois que vous avez ajouter votre module en dépendance dans le Carego.toml de `durs-server`, il vas falloir utiliser votre module dans le main.rs :
1. Importez la crate principale de votre module, repéréz ou se trouve les autres lignes extern crate puis ajoutez la votre : 1. Utilisez votre structure implémentant le trait DursModule :
extern crate durs_toto;
2. Utilisez la structure implémentant le trait DursModule :
pub use durs_toto::TotoModule; pub use durs_toto::TotoModule;
3. Ajouter votre module en paramètre de la macro `durs_plug!` : 2. Ajouter votre module en paramètre de la macro `durs_plug!` :
durs_plug!([WS2PModule], [TuiModule, .., TotoModule]) durs_plug!([WS2PModule], [TuiModule, .., TotoModule])
Notez que `durs_plug!` prend en paramètre 2 tableaux de modules, le 1er correspond aux modules de type réseau inter-noeuds, tout les autres modules doivent se trouver dans le 2ème tableau. Notez que `durs_plug!` prend en paramètre 2 tableaux de modules, le 1er correspond aux modules de type réseau inter-noeuds, tout les autres modules doivent se trouver dans le 2ème tableau.
4. Si votre module doit injecter une sous-commande dans la ligne de commande `durs`, ajoutez le également a la macro `durs_inject_cli!` : 3. Si votre module doit injecter une sous-commande dans la ligne de commande `durs`, ajoutez le également a la macro `durs_inject_cli!` :
durs_inject_cli![WS2PModule, .., TotoModule], durs_inject_cli![WS2PModule, .., TotoModule],
......
...@@ -22,8 +22,6 @@ ...@@ -22,8 +22,6 @@
unused_qualifications unused_qualifications
)] )]
extern crate rpassword;
use crate::*; use crate::*;
use std::io; use std::io;
......
...@@ -33,13 +33,6 @@ extern crate serde_derive; ...@@ -33,13 +33,6 @@ extern crate serde_derive;
#[macro_use] #[macro_use]
extern crate serde_json; extern crate serde_json;
extern crate dirs;
extern crate dubp_documents;
extern crate duniter_module;
extern crate dup_crypto;
extern crate rand;
extern crate serde;
pub mod keys; pub mod keys;
use dubp_documents::CurrencyName; use dubp_documents::CurrencyName;
......
...@@ -32,7 +32,7 @@ pub fn change_global_conf<DC: DuniterConf>( ...@@ -32,7 +32,7 @@ pub fn change_global_conf<DC: DuniterConf>(
} }
// Write new conf // Write new conf
super::duniter_conf::write_conf_file(profile, &conf).expect("IOError : Fail to update conf "); ::duniter_conf::write_conf_file(profile, &conf).expect("IOError : Fail to update conf ");
println!("Configuration successfully updated."); println!("Configuration successfully updated.");
} }
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
//! Durs-core cli : dbex subcommands. //! Durs-core cli : dbex subcommands.
extern crate structopt;
#[derive(StructOpt, Debug, Clone)] #[derive(StructOpt, Debug, Clone)]
#[structopt( #[structopt(
name = "dbex", name = "dbex",
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
//! Durs-core cli : dbex subcommands. //! Durs-core cli : dbex subcommands.
extern crate structopt;
#[derive(StructOpt, Debug, Clone)] #[derive(StructOpt, Debug, Clone)]
#[structopt( #[structopt(
name = "keys", name = "keys",
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
//! Define durs-core cli subcommands options. //! Define durs-core cli subcommands options.
extern crate structopt;
pub mod dbex; pub mod dbex;
pub mod keys; pub mod keys;
pub mod modules; pub mod modules;
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
//! Durs-core cli : modules manager subcommands. //! Durs-core cli : modules manager subcommands.
extern crate structopt;
use duniter_module::*; use duniter_module::*;
use std::collections::HashSet; use std::collections::HashSet;
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
//! Durs-core cli : reset subcommand. //! Durs-core cli : reset subcommand.
extern crate structopt;
use crate::cli::InvalidInput; use crate::cli::InvalidInput;
use std::str::FromStr; use std::str::FromStr;
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
//! Durs-core cli : start subcommands. //! Durs-core cli : start subcommands.
extern crate structopt;
#[derive(StructOpt, Debug, Copy, Clone)] #[derive(StructOpt, Debug, Copy, Clone)]
#[structopt( #[structopt(
name = "start", name = "start",
......
...@@ -33,19 +33,6 @@ extern crate log; ...@@ -33,19 +33,6 @@ extern crate log;
#[macro_use] #[macro_use]
extern crate structopt; extern crate structopt;
extern crate dirs;
extern crate duniter_conf;
extern crate duniter_module;
extern crate duniter_network;
extern crate dup_crypto;
extern crate durs_blockchain;
extern crate durs_message;
extern crate durs_network_documents;
extern crate log_panics;
extern crate serde_json;
extern crate simplelog;
extern crate threadpool;
pub mod change_conf; pub mod change_conf;
pub mod cli; pub mod cli;
pub mod router; pub mod router;
......
...@@ -28,14 +28,6 @@ ...@@ -28,14 +28,6 @@
unused_qualifications unused_qualifications
)] )]
extern crate dubp_documents;
extern crate duniter_module;
extern crate duniter_network;
extern crate dup_crypto;
extern crate durs_network_documents;
extern crate serde;
extern crate serde_json;
use duniter_module::*; use duniter_module::*;
use durs_network_documents::network_endpoint::EndpointEnum; use durs_network_documents::network_endpoint::EndpointEnum;
......
...@@ -32,13 +32,6 @@ ...@@ -32,13 +32,6 @@
#[macro_use] #[macro_use]
extern crate serde_derive; extern crate serde_derive;
extern crate dubp_documents;
extern crate dup_crypto;
extern crate durs_network_documents;
extern crate serde;
extern crate serde_json;
extern crate structopt;
use dubp_documents::CurrencyName; use dubp_documents::CurrencyName;
use dup_crypto::keys::{KeyPair, KeyPairEnum}; use dup_crypto::keys::{KeyPair, KeyPairEnum};
use durs_network_documents::network_endpoint::EndpointEnum; use durs_network_documents::network_endpoint::EndpointEnum;
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
//! Durs network cli : sync subcommands. //! Durs network cli : sync subcommands.
extern crate structopt;
use std::str::FromStr; use std::str::FromStr;
#[derive(StructOpt, Debug, Clone)] #[derive(StructOpt, Debug, Clone)]
......
...@@ -28,12 +28,6 @@ ...@@ -28,12 +28,6 @@
unused_qualifications unused_qualifications
)] )]
extern crate dubp_documents;
extern crate duniter_module;
extern crate dup_crypto;
extern crate durs_network_documents;
extern crate serde;
extern crate serde_json;
#[macro_use] #[macro_use]
extern crate structopt; extern crate structopt;
......
...@@ -13,9 +13,6 @@ ...@@ -13,9 +13,6 @@
// You should have received a copy of the GNU Affero General Public License // 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/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
extern crate dubp_documents;
extern crate durs_wot;
use crate::{BinDB, CertsExpirV10Datas, DALError}; use crate::{BinDB, CertsExpirV10Datas, DALError};
use dubp_documents::BlockId; use dubp_documents::BlockId;
use durs_wot::NodeId; use durs_wot::NodeId;
......
...@@ -32,16 +32,9 @@ ...@@ -32,16 +32,9 @@
#[macro_use] #[macro_use]
extern crate log; extern crate log;
extern crate serde_json;
#[macro_use] #[macro_use]
extern crate serde_derive; extern crate serde_derive;
extern crate dubp_documents;
extern crate dup_crypto;
extern crate durs_wot;
extern crate rustbreak;
extern crate serde;
/// Define balance operations /// Define balance operations
pub mod balance; pub mod balance;
......
...@@ -13,9 +13,6 @@ ...@@ -13,9 +13,6 @@
// You should have received a copy of the GNU Affero General Public License // 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/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
extern crate dubp_documents;
extern crate dup_crypto;
use dubp_documents::v10::transaction::*; use dubp_documents::v10::transaction::*;
use dubp_documents::BlockId; use dubp_documents::BlockId;
use dup_crypto::hashs::Hash; use dup_crypto::hashs::Hash;
......
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
// You should have received a copy of the GNU Affero General Public License // 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/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
extern crate durs_wot;
use durs_wot::operations::centrality::{CentralitiesCalculator, UlrikBrandesCentralityCalculator}; use durs_wot::operations::centrality::{CentralitiesCalculator, UlrikBrandesCentralityCalculator};
use durs_wot::operations::distance::{ use durs_wot::operations::distance::{
DistanceCalculator, RustyDistanceCalculator, WotDistance, WotDistanceParameters, DistanceCalculator, RustyDistanceCalculator, WotDistance, WotDistanceParameters,
......
...@@ -32,19 +32,6 @@ ...@@ -32,19 +32,6 @@
#[macro_use] #[macro_use]
extern crate log; extern crate log;
extern crate dirs;
extern crate dubp_documents;
extern crate duniter_conf;
extern crate duniter_module;
extern crate duniter_network;
extern crate dup_crypto;
extern crate durs_blockchain_dal;
extern crate durs_message;
extern crate durs_network_documents;
extern crate durs_wot;
extern crate serde;
extern crate sqlite;
mod apply_valid_block; mod apply_valid_block;
mod check_and_apply_block; mod check_and_apply_block;
mod dbex; mod dbex;
......
...@@ -13,13 +13,6 @@ ...@@ -13,13 +13,6 @@
// You should have received a copy of the GNU Affero General Public License // 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/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
extern crate num_cpus;
extern crate pbr;
extern crate sqlite;
extern crate threadpool;
use self::pbr::ProgressBar;
use self::threadpool::ThreadPool;
use crate::ts_parsers::*; use crate::ts_parsers::*;
use crate::*; use crate::*;
use dubp_documents::{BlockHash, BlockId}; use dubp_documents::{BlockHash, BlockId};
...@@ -30,12 +23,14 @@ use durs_blockchain_dal::currency_params::CurrencyParameters; ...@@ -30,12 +23,14 @@ use durs_blockchain_dal::currency_params::CurrencyParameters;
use durs_blockchain_dal::writers::requests::*; use durs_blockchain_dal::writers::requests::*;
use durs_blockchain_dal::ForkId; use durs_blockchain_dal::ForkId;
use durs_wot::NodeId; use durs_wot::NodeId;
use pbr::ProgressBar;
use std::collections::{HashMap, VecDeque}; use std::collections::{HashMap, VecDeque};
use std::fs; use std::fs;
use std::ops::Deref; use std::ops::Deref;
use std::sync::mpsc; use std::sync::mpsc;
use std::thread; use std::thread;
use std::time::SystemTime; use std::time::SystemTime;
use threadpool::ThreadPool;
/// Number of sync jobs /// Number of sync jobs
pub static NB_SYNC_JOBS: &'static usize = &4; pub static NB_SYNC_JOBS: &'static usize = &4;
......
...@@ -13,9 +13,6 @@ ...@@ -13,9 +13,6 @@
// You should have received a copy of the GNU Affero General Public License // 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/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
extern crate serde_json;
extern crate sqlite;
use crate::sync::BlockHeader; use crate::sync::BlockHeader;
use dubp_documents::v10::block::{BlockV10Parameters, TxDocOrTxHash}; use dubp_documents::v10::block::{BlockV10Parameters, TxDocOrTxHash};
use dubp_documents::v10::identity::*; use dubp_documents::v10::identity::*;
......
...@@ -35,14 +35,6 @@ extern crate serde_derive; ...@@ -35,14 +35,6 @@ extern crate serde_derive;
#[macro_use] #[macro_use]
extern crate structopt; extern crate structopt;
extern crate duniter_conf;
extern crate duniter_module;
extern crate duniter_network;
extern crate dup_crypto;
extern crate durs_message;
extern crate serde;
extern crate serde_json;
use duniter_conf::DuRsConf; use duniter_conf::DuRsConf;
use duniter_module::*; use duniter_module::*;
use duniter_network::events::NetworkEvent; use duniter_network::events::NetworkEvent;
......
...@@ -36,17 +36,6 @@ extern crate serde_derive; ...@@ -36,17 +36,6 @@ extern crate serde_derive;
#[macro_use] #[macro_use]
extern crate structopt; extern crate structopt;
extern crate dubp_documents;
extern crate duniter_conf;
extern crate duniter_module;
extern crate duniter_network;
extern crate dup_crypto;
extern crate durs_message;
extern crate durs_network_documents;
extern crate serde;
extern crate serde_json;
extern crate termion;
use duniter_conf::DuRsConf; use duniter_conf::DuRsConf;
use duniter_module::*; use duniter_module::*;
use duniter_network::events::NetworkEvent; use duniter_network::events::NetworkEvent;
......
extern crate dup_crypto;
extern crate serde;
extern crate serde_json;
use self::serde::ser::{Serialize, SerializeStruct, Serializer};
use super::WS2PMessage; use super::WS2PMessage;
use dup_crypto::keys::*; use dup_crypto::keys::*;
use serde::ser::{Serialize, SerializeStruct, Serializer};
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct WS2PAckMessageV1 { pub struct WS2PAckMessageV1 {
......
extern crate dup_crypto;
extern crate serde;
extern crate serde_json;
use self::serde::ser::{Serialize, SerializeStruct, Serializer};
use super::WS2PMessage; use super::WS2PMessage;
use dup_crypto::keys::*; use dup_crypto::keys::*;
use serde::ser::{Serialize, SerializeStruct, Serializer};
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct WS2PConnectMessageV1 { pub struct WS2PConnectMessageV1 {
......
...@@ -36,18 +36,6 @@ extern crate serde_json; ...@@ -36,18 +36,6 @@ extern crate serde_json;
#[macro_use] #[macro_use]
extern crate structopt; extern crate structopt;
extern crate byteorder;
extern crate dubp_documents;
extern crate duniter_conf;
extern crate duniter_module;
extern crate duniter_network;
extern crate dup_crypto;
extern crate durs_message;
extern crate durs_network_documents;
extern crate rand;
extern crate sqlite;
extern crate ws;
mod ack_message; mod ack_message;
mod connect_message; mod connect_message;
pub mod constants; pub mod constants;
...@@ -943,13 +931,6 @@ impl DursModule<DuRsConf, DursMsg> for WS2PModule { ...@@ -943,13 +931,6 @@ impl DursModule<DuRsConf, DursMsg> for WS2PModule {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
extern crate dubp_documents;
extern crate duniter_conf;
extern crate duniter_module;
extern crate duniter_network;
extern crate dup_crypto;
extern crate durs_message;
use super::parsers::blocks::parse_json_block; use super::parsers::blocks::parse_json_block;
use super::*; use super::*;
use dubp_documents::v10::BlockDocument; use dubp_documents::v10::BlockDocument;
......
extern crate dup_crypto;
extern crate serde;
extern crate serde_json;
use self::serde::ser::{Serialize, SerializeStruct, Serializer};
use super::WS2PMessage; use super::WS2PMessage;
use dup_crypto::keys::*; use dup_crypto::keys::*;
use serde::ser::{Serialize, SerializeStruct, Serializer};
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct WS2POkMessageV1 { pub struct WS2POkMessageV1 {
......
extern crate serde_json;
use super::excluded::parse_exclusions_from_json_value; use super::excluded::parse_exclusions_from_json_value;
use super::identities::parse_compact_identity; use super::identities::parse_compact_identity;
use super::transactions::parse_transaction; use super::transactions::parse_transaction;
......
extern crate serde;
extern crate serde_json;
use dup_crypto::keys::ed25519; use dup_crypto::keys::ed25519;
use dup_crypto::keys::*; use dup_crypto::keys::*;
......
extern crate serde_json;
use dubp_documents::v10::identity::*; use dubp_documents::v10::identity::*;
use dubp_documents::Blockstamp; use dubp_documents::Blockstamp;
use dubp_documents::DocumentBuilder; use dubp_documents::DocumentBuilder;
......
extern crate serde_json;
use dubp_documents::v10::membership::*; use dubp_documents::v10::membership::*;
use dubp_documents::Blockstamp; use dubp_documents::Blockstamp;
use dubp_documents::DocumentBuilder; use dubp_documents::DocumentBuilder;
......
extern crate serde;
extern crate serde_json;
use dubp_documents::v10::transaction::{ use dubp_documents::v10::transaction::{
TransactionDocument, TransactionDocumentBuilder, TransactionInput, TransactionInputUnlocks, TransactionDocument, TransactionDocumentBuilder, TransactionInput, TransactionInputUnlocks,
TransactionOutput, TransactionOutput,
......
extern crate serde_json;
use durs_network_documents::network_head::*; use durs_network_documents::network_head::*;
use std::ops::Deref; use std::ops::Deref;
......
extern crate duniter_network;
extern crate dup_crypto;
extern crate serde;
extern crate serde_json;
use duniter_network::requests::OldNetworkRequest; use duniter_network::requests::OldNetworkRequest;
pub fn network_request_to_json(request: &OldNetworkRequest) -> serde_json::Value { pub fn network_request_to_json(request: &OldNetworkRequest) -> serde_json::Value {
......
...@@ -34,12 +34,6 @@ extern crate pretty_assertions;*/ ...@@ -34,12 +34,6 @@ extern crate pretty_assertions;*/
#[macro_use] #[macro_use]
extern crate serde_derive; extern crate serde_derive;
extern crate bincode;
extern crate byteorder;
extern crate dubp_documents;
extern crate dup_crypto;
extern crate durs_network_documents;
/// WS2Pv2 Messages /// WS2Pv2 Messages
pub mod v2; pub mod v2;
......
// Copyright (C) 2018 The Durs Project Developers.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// 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/>.
pub static WS2P_DEFAULT_OUTCOMING_QUOTA: &'static usize = &10;
/*pub static WS2P_OUTCOMING_INTERVAL_AT_STARTUP: &'static u64 = &75;
pub static WS2P_OUTCOMING_INTERVAL: &'static u64 = &300;*/
pub static WS2P_NEGOTIATION_TIMEOUT: &'static u64 = &15_000;
pub static WS2P_EXPIRE_TIMEOUT_IN_SECS: &'static u64 = &120;
pub static WS2P_RECV_SERVICE_FREQ_IN_MS: &'static u64 = &1_000;
pub static WS2P_SPAM_INTERVAL_IN_MILLI_SECS: &'static u64 = &80;
pub static WS2P_SPAM_LIMIT: &'static usize = &6;
pub static WS2P_SPAM_SLEEP_TIME_IN_SEC: &'static u64 = &100;