From 7d0a371311c8ca4a557c7445c200e7950865d521 Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Fri, 27 Mar 2020 23:26:16 +0100 Subject: [PATCH] Changed ruleset variable type to i32 --- src/settings/mod.rs | 10 +++++----- src/settings/utils.rs | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/settings/mod.rs b/src/settings/mod.rs index 13f23df..926156d 100644 --- a/src/settings/mod.rs +++ b/src/settings/mod.rs @@ -4,14 +4,13 @@ extern crate serde_yaml; use serde::{Deserialize, Serialize}; extern crate log; -use log::warn; +use log::{info, warn}; // mod utils; pub mod utils; use utils::SettingsType; -#[allow(dead_code)] -const RULESET_CURRENT_VERSION: &'static str = "1"; +const RULESET_CURRENT_VERSION: i32 = 1; #[derive(Debug, Deserialize, Serialize)] pub struct Settings { @@ -106,7 +105,7 @@ impl Settings { Ok(val) => val, }, }; - + info!("Successfuly imported {}", path.display()); Ok(settings) } @@ -161,12 +160,13 @@ impl Settings { Ok(val) => val, }, }; + info!("Successfuly exported settings to {}", path.display()); utils::write_file(&path, &content) } /// Get the current ruleset version of LangEvolve. fn get_ruleset_version() -> String { - String::from(RULESET_CURRENT_VERSION) + RULESET_CURRENT_VERSION.to_string() } } diff --git a/src/settings/utils.rs b/src/settings/utils.rs index 557c449..ece95b5 100644 --- a/src/settings/utils.rs +++ b/src/settings/utils.rs @@ -6,6 +6,7 @@ use std::io::{Read, Result}; use std::path::Path; /// Type of supported settings format: yaml or json +#[derive(Debug, PartialEq)] pub enum SettingsType { /// Files ending with the `yml` or `yaml` extension Yaml, @@ -78,6 +79,7 @@ where info!("Wrote settings to file {}", path.display()); } }; + info!("Successfuly written {}", path.display()); Ok(()) }