Remove unnecessary code

This commit removes some unnecessary code, such as an extra `String`
clone, unnecessary `return` statements, and an inherent `to_string`
function for the `Regex` wrapper.

A double-quote character considered as a string literal by the
compiler was also changed to a single-quote character, this time
considered as a character by the compiler, for some optimization.

Also a newline is added in order to improve code readablitiy.
This commit is contained in:
2020-07-11 17:37:45 +02:00
parent 3c960eaa35
commit a8bafc072b
4 changed files with 5 additions and 8 deletions

View File

@@ -87,6 +87,7 @@ macro_rules! decode_settings {
}
use std::collections::HashMap;
/// Representation of the softwares 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<String, String> {
// 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)
}
},
}