diff --git a/src/settings/mod.rs b/src/settings/mod.rs index 9da6efe..c56553d 100644 --- a/src/settings/mod.rs +++ b/src/settings/mod.rs @@ -87,6 +87,7 @@ macro_rules! decode_settings { } use std::collections::HashMap; + /// Representation of the software’s settings /// /// This struct represents all the settings the software has to follow @@ -334,7 +335,7 @@ impl Settings { pub fn apply(&self, s: String) -> std::result::Result { // TODO Add Error handling let rules = self.update_rules().unwrap(); - let mut s = s.clone(); + let mut s = s; debug!("==============================================="); for rule in rules { debug!( @@ -379,7 +380,7 @@ impl FromStr for Settings { Ok(val) => Ok(val), Err(e) => { error!("Could not decode input {}: {}", s, e.to_string()); - return Err(e); + Err(e) } }, } diff --git a/src/settings/rule/mod.rs b/src/settings/rule/mod.rs index 3563945..6ae92a0 100644 --- a/src/settings/rule/mod.rs +++ b/src/settings/rule/mod.rs @@ -95,7 +95,7 @@ impl Rule { impl From for Rule { fn from(source: String) -> Self { - let components: Vec<&str> = source.split_terminator(">").collect(); + let components: Vec<&str> = source.split_terminator('>').collect(); Self { from: Regex::new(components[0]), to: String::from(components[1]), diff --git a/src/settings/rule/regex_wrapper.rs b/src/settings/rule/regex_wrapper.rs index a819765..a035894 100644 --- a/src/settings/rule/regex_wrapper.rs +++ b/src/settings/rule/regex_wrapper.rs @@ -11,10 +11,6 @@ impl Regex { pub fn as_str(&self) -> &str { self.0.as_str() } - - pub fn to_string(&self) -> String { - self.0.to_string() - } } use std::hash::{Hash, Hasher}; diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 5ef64cf..04a7d3a 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -39,7 +39,7 @@ pub fn read_file(path: &Path) -> Result { match file.read_to_string(&mut content) { Err(why) => { error!("Could not read {}: {}", display, why.to_string()); - return Err(why); + Err(why) } Ok(_) => { info!("Content of {} read", display);