Clippy changes
Some checks failed
Rust Build / Check (pull_request) Failing after 25s
Rust Build / Test Suite (pull_request) Failing after 26s
Rust Build / Rustfmt (pull_request) Successful in 26s
Rust Build / Clippy (pull_request) Failing after 28s
Rust Build / build (pull_request) Failing after 25s
Some checks failed
Rust Build / Check (pull_request) Failing after 25s
Rust Build / Test Suite (pull_request) Failing after 26s
Rust Build / Rustfmt (pull_request) Successful in 26s
Rust Build / Clippy (pull_request) Failing after 28s
Rust Build / build (pull_request) Failing after 25s
This commit is contained in:
24
src/song.rs
24
src/song.rs
@@ -96,18 +96,18 @@ impl Default for Song {
|
||||
impl Song {
|
||||
pub fn to_metadata_json(&self, pretty: bool) -> Result<String, serde_json::Error> {
|
||||
if 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)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn song_path(&self) -> Result<String, std::io::Error> {
|
||||
if self.directory.is_empty() {
|
||||
return Err(std::io::Error::new(
|
||||
Err(std::io::Error::new(
|
||||
std::io::ErrorKind::Other,
|
||||
"Directory does not exist",
|
||||
));
|
||||
))
|
||||
}
|
||||
|
||||
let directory = &self.directory;
|
||||
@@ -121,12 +121,12 @@ impl Song {
|
||||
|
||||
buffer += &self.filename.clone();
|
||||
|
||||
return Ok(buffer);
|
||||
Ok(buffer)
|
||||
} else {
|
||||
return Err(std::io::Error::new(
|
||||
Err(std::io::Error::new(
|
||||
std::io::ErrorKind::Other,
|
||||
"Could not access last character of directory",
|
||||
));
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,17 +140,15 @@ impl Song {
|
||||
file.read_to_end(&mut buffer)?;
|
||||
|
||||
if buffer.len() == 0 {
|
||||
return Err(std::io::Error::new(
|
||||
Err(std::io::Error::new(
|
||||
std::io::ErrorKind::Other,
|
||||
"File is empty",
|
||||
));
|
||||
))
|
||||
} else {
|
||||
return Ok(buffer);
|
||||
Ok(buffer)
|
||||
}
|
||||
}
|
||||
Err(er) => {
|
||||
return Err(er);
|
||||
}
|
||||
Err(er) => Err(er),
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user