Fixed some warnings #11

Merged
phoenix merged 13 commits from warning_fixes into devel 2025-03-22 18:24:09 +00:00
2 changed files with 6 additions and 6 deletions
Showing only changes of commit d9bc2c5d09 - Show all commits

View File

@@ -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",

View File

@@ -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)
}
}
}