From de45ffc15cf9c5b50d1de62b491fc1dd7872b822 Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Sat, 11 Jul 2020 17:34:01 +0200 Subject: [PATCH] Update dependencies, remove unneeded keywords and declarations Also declaration of a lazy_static element was moved in a better spot --- Cargo.toml | 10 +++++++--- src/lib.rs | 6 +----- src/settings/mod.rs | 6 ++---- src/settings/rule/mod.rs | 12 ++++++------ src/utils/mod.rs | 1 - 5 files changed, 16 insertions(+), 19 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5baa8a6..7222314 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,11 +9,15 @@ edition = "2018" [dependencies] # Logger log = "0.4" -simplelog = "0.7" +simplelog = "0.8" # Struct serializing and deserializing serde = {version = "1.0", features = ["derive"]} -serde_yaml = "0.7" +serde_yaml = "0.8" serde_json = "1.0" # Regex support regex = "1.3" -lazy_static = "1.4.0" +lazy_static = "1.4" + +# [dev-dependencies] +# Pretty output +prettydiff = "0.3" diff --git a/src/lib.rs b/src/lib.rs index 5b1f9d8..37535e7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,12 +12,8 @@ //! [original software](https://github.com/ceronyon/LangEvolve) which applies //! user-defined sound changes to words and texts based on regex expressions. -#[macro_use] -extern crate lazy_static; - use std::fs::File; -extern crate log; -extern crate simplelog; + use log::{info, warn}; use simplelog::*; diff --git a/src/settings/mod.rs b/src/settings/mod.rs index 40f839b..8315305 100644 --- a/src/settings/mod.rs +++ b/src/settings/mod.rs @@ -1,13 +1,11 @@ -extern crate serde; -extern crate serde_json; -extern crate serde_yaml; use serde::{Deserialize, Serialize}; -extern crate log; use log::{debug, error, info}; use crate::utils::{self, SettingsType}; +use prettydiff::diff_words; + mod rule; use rule::Rule; diff --git a/src/settings/rule/mod.rs b/src/settings/rule/mod.rs index a233fb5..3563945 100644 --- a/src/settings/rule/mod.rs +++ b/src/settings/rule/mod.rs @@ -1,13 +1,16 @@ use std::collections::HashMap; -extern crate serde; -extern crate serde_json; -extern crate serde_yaml; use serde::{Deserialize, Serialize}; +use lazy_static::lazy_static; + mod regex_wrapper; use regex_wrapper::Regex; +lazy_static! { + static ref RE : Regex = Regex::new("%([A-Z])"); +} + /// Representation of a rule in LangEvolveRs #[derive(Debug, Serialize, Deserialize, Clone)] pub struct Rule { @@ -34,9 +37,6 @@ impl Rule { } fn detect_categories(&self) -> (u8, u8) { - lazy_static! { - static ref RE : Regex = Regex::new("%([A-Z])"); - } let captures_from = match RE.captures(self.from.as_str()) { None => 0 as u8, Some(c) => c.len() as u8, diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 184f47b..5ef64cf 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -1,4 +1,3 @@ -extern crate log; use log::{info, error}; use std::fs::File;