diff --git a/src/song.rs b/src/song.rs index e3657da..e568a77 100644 --- a/src/song.rs +++ b/src/song.rs @@ -111,7 +111,7 @@ impl Song { } let directory = &self.directory; - let mut buffer: String = String::from(directory.clone()); + let mut buffer: String = directory.clone(); let last_index = directory.len() - 1; if let Some(character) = directory.chars().nth(last_index) { @@ -139,7 +139,7 @@ impl Song { let mut buffer: Vec = Vec::new(); file.read_to_end(&mut buffer)?; - if buffer.len() == 0 { + if buffer.is_empty() { Err(std::io::Error::new( std::io::ErrorKind::Other, "File is empty", @@ -215,7 +215,7 @@ mod embedded { } let directory = &self.directory; - let mut buffer: String = String::from(directory.clone()); + let mut buffer: String = directory.clone(); let last_index = directory.len() - 1; if let Some(character) = directory.chars().nth(last_index) { @@ -243,7 +243,7 @@ mod embedded { let mut buffer: Vec = Vec::new(); file.read_to_end(&mut buffer)?; - if buffer.len() == 0 { + if buffer.is_empty() { return Err(std::io::Error::new( std::io::ErrorKind::Other, "File is empty", diff --git a/src/user.rs b/src/user.rs index 04fe442..07f2a59 100644 --- a/src/user.rs +++ b/src/user.rs @@ -52,9 +52,9 @@ impl Default for User { impl User { pub fn to_json(&self, output_pretty: bool) -> Result { if output_pretty { - return serde_json::to_string_pretty(&self); + serde_json::to_string_pretty(&self) } else { - return serde_json::to_string(&self); + serde_json::to_string(&self) } } }