From a9dde429c13c5e756095f81e44eab722d3e1c46c Mon Sep 17 00:00:00 2001
From: librelois <elois@ifee.fr>
Date: Thu, 1 Nov 2018 18:44:11 +0100
Subject: [PATCH] [ref] remove unused crates & delete some useless code

---
 Cargo.lock                    | 12 ------------
 blockchain/Cargo.toml         |  2 --
 blockchain/lib.rs             |  1 -
 dal/Cargo.toml                |  2 --
 dal/lib.rs                    |  5 -----
 dal/parsers/certifications.rs |  4 +---
 dal/parsers/revoked.rs        |  7 +++----
 dal/writers/certification.rs  |  3 ---
 dal/writers/requests.rs       |  3 ---
 documents/Cargo.toml          |  2 --
 documents/src/lib.rs          |  1 -
 11 files changed, 4 insertions(+), 38 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index 04d2f85e..5d99c9f4 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -220,10 +220,8 @@ dependencies = [
  "log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "pbr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustbreak 2.0.0-rc2 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde 1.0.78 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_derive 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_json 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)",
  "sqlite 0.23.9 (registry+https://github.com/rust-lang/crates.io-index)",
  "threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -286,9 +284,7 @@ dependencies = [
  "duniter-module 0.1.0-a0.1",
  "duniter-network 0.1.0-a0.1",
  "durs-wot 0.8.0-a0.9",
- "lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustbreak 2.0.0-rc2 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde 1.0.78 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -304,8 +300,6 @@ dependencies = [
  "base64 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "duniter-crypto 0.2.0-a0.1",
- "lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "pest 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "pest_derive 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -603,11 +597,6 @@ dependencies = [
  "vcpkg 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
-[[package]]
-name = "linked-hash-map"
-version = "0.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
 [[package]]
 name = "log"
 version = "0.4.2"
@@ -1270,7 +1259,6 @@ dependencies = [
 "checksum lazycell 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a6f08839bc70ef4a3fe1d566d5350f519c5912ea86be0df1740a7d247c7fc0ef"
 "checksum libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)" = "b685088df2b950fccadf07a7187c8ef846a959c142338a48f9dc0b94517eb5f1"
 "checksum libz-sys 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)" = "87f737ad6cc6fd6eefe3d9dc5412f1573865bded441300904d2f42269e140f16"
-"checksum linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "70fb39025bc7cdd76305867c4eccf2f2dcf6e9a57f5b21a93e1c2d86cd03ec9e"
 "checksum log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6fddaa003a65722a7fb9e26b0ce95921fe4ba590542ced664d8ce2fa26f9f3ac"
 "checksum log-panics 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ae0136257df209261daa18d6c16394757c63e032e27aafd8b07788b051082bef"
 "checksum maplit 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08cbb6b4fef96b6d77bfc40ec491b1690c779e77b05cd9f07f787ed376fd4c43"
diff --git a/blockchain/Cargo.toml b/blockchain/Cargo.toml
index ebe5daa8..321ae132 100644
--- a/blockchain/Cargo.toml
+++ b/blockchain/Cargo.toml
@@ -22,10 +22,8 @@ durs-wot = { path = "../wot" }
 log = "0.4.*"
 num_cpus = "1.8.*"
 pbr = "1.0.*"
-rand = "0.4.*"
 rustbreak = {version = "2.0.0-rc2", features = ["bin_enc"]}
 serde = "1.0.*"
-serde_derive = "1.0.*"
 serde_json = "1.0.*"
 sqlite = "0.23.*"
 threadpool = "1.7.*"
\ No newline at end of file
diff --git a/blockchain/lib.rs b/blockchain/lib.rs
index 75ca3e4f..dd1009ee 100644
--- a/blockchain/lib.rs
+++ b/blockchain/lib.rs
@@ -43,7 +43,6 @@ extern crate duniter_network;
 extern crate durs_network_documents;
 extern crate durs_wot;
 extern crate serde;
-extern crate serde_json;
 extern crate sqlite;
 
 mod apply_valid_block;
diff --git a/dal/Cargo.toml b/dal/Cargo.toml
index 24ec2943..9788292a 100644
--- a/dal/Cargo.toml
+++ b/dal/Cargo.toml
@@ -14,9 +14,7 @@ duniter-documents = { path = "../documents" }
 duniter-module = { path = "../module" }
 duniter-network = { path = "../network" }
 durs-wot = { path = "../wot" }
-lazy_static = "1.0.*"
 log = "0.4.*"
-rand = "0.4.*"
 rustbreak = {version = "2.0.0-rc2", features = ["bin_enc"]}
 rust-crypto = "0.2.*"
 serde = "1.0.*"
diff --git a/dal/lib.rs b/dal/lib.rs
index 07093a9a..0819c56f 100644
--- a/dal/lib.rs
+++ b/dal/lib.rs
@@ -32,7 +32,6 @@
 
 #[macro_use]
 extern crate log;
-#[macro_use]
 extern crate serde_json;
 #[macro_use]
 extern crate serde_derive;
@@ -440,10 +439,6 @@ pub struct WotStats {
     pub centralities: Vec<u64>,
 }*/
 
-fn _use_json_macro() -> serde_json::Value {
-    json!({})
-}
-
 /// Open Rustbreak memory database
 pub fn open_memory_db<D: Serialize + DeserializeOwned + Debug + Default + Clone + Send>(
 ) -> Result<MemoryDatabase<D, Bincode>, DALError> {
diff --git a/dal/parsers/certifications.rs b/dal/parsers/certifications.rs
index e5753986..378c498b 100644
--- a/dal/parsers/certifications.rs
+++ b/dal/parsers/certifications.rs
@@ -13,13 +13,11 @@
 // 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/>.
 
-extern crate serde;
-extern crate serde_json;
-
 use duniter_crypto::keys::*;
 use duniter_documents::v10::certification::{CertificationDocument, CompactCertificationDocument};
 use duniter_documents::v10::TextDocumentFormat;
 use duniter_documents::BlockId;
+use serde_json;
 
 /// Parse array of certification json documents into vector of `CompactCertificationDocument`
 pub fn parse_certifications_into_compact(
diff --git a/dal/parsers/revoked.rs b/dal/parsers/revoked.rs
index 2b22e996..3ad39ccd 100644
--- a/dal/parsers/revoked.rs
+++ b/dal/parsers/revoked.rs
@@ -13,18 +13,17 @@
 // 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/>.
 
-extern crate serde_json;
-
 use duniter_crypto::keys::*;
 use duniter_documents::v10::revocation::{CompactRevocationDocument, RevocationDocument};
 use duniter_documents::v10::TextDocumentFormat;
+use serde_json;
 
 /// Parse array of revocations json documents into vector of `CompactRevocationDocument`
 pub fn parse_revocations_into_compact(
-    json_recocations: &[serde_json::Value],
+    json_revocations: &[serde_json::Value],
 ) -> Vec<TextDocumentFormat<RevocationDocument>> {
     let mut revocations: Vec<TextDocumentFormat<RevocationDocument>> = Vec::new();
-    for revocation in json_recocations.iter() {
+    for revocation in json_revocations.iter() {
         let revocations_datas: Vec<&str> = revocation
             .as_str()
             .expect("Receive block in wrong format !")
diff --git a/dal/writers/certification.rs b/dal/writers/certification.rs
index bb61ffe8..110212f9 100644
--- a/dal/writers/certification.rs
+++ b/dal/writers/certification.rs
@@ -13,9 +13,6 @@
 // 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/>.
 
-extern crate serde;
-extern crate serde_json;
-
 use currency_params::CurrencyParameters;
 use duniter_crypto::keys::*;
 use duniter_documents::v10::certification::CompactCertificationDocument;
diff --git a/dal/writers/requests.rs b/dal/writers/requests.rs
index 5e00a01d..40422fad 100644
--- a/dal/writers/requests.rs
+++ b/dal/writers/requests.rs
@@ -13,9 +13,6 @@
 // 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/>.
 
-extern crate serde;
-extern crate serde_json;
-
 use block::DALBlock;
 use currency_params::CurrencyParameters;
 use duniter_crypto::keys::PubKey;
diff --git a/documents/Cargo.toml b/documents/Cargo.toml
index a0633f80..529506c9 100644
--- a/documents/Cargo.toml
+++ b/documents/Cargo.toml
@@ -16,8 +16,6 @@ base58 = "0.1.*"
 base64 = "0.9.*"
 byteorder = "1.2.3"
 duniter-crypto = { path = "../crypto" }
-lazy_static = "1.0.*"
-linked-hash-map = "0.5.*"
 pest = "2.0"
 pest_derive = "2.0"
 rust-crypto = "0.2.*"
diff --git a/documents/src/lib.rs b/documents/src/lib.rs
index 9ee020c3..bff1cc70 100644
--- a/documents/src/lib.rs
+++ b/documents/src/lib.rs
@@ -31,7 +31,6 @@ extern crate base64;
 extern crate byteorder;
 extern crate crypto;
 extern crate duniter_crypto;
-extern crate linked_hash_map;
 extern crate pest;
 #[macro_use]
 extern crate pest_derive;
-- 
GitLab