Fixed some warnings #11
@@ -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<u8> = 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<u8> = 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",
|
||||
|
@@ -52,9 +52,9 @@ impl Default for User {
|
||||
impl User {
|
||||
pub fn to_json(&self, output_pretty: bool) -> Result<String, serde_json::Error> {
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user