rust std change (#42)
Some checks failed
Release Tagging / release (push) Failing after 29s
Rust Build / Rustfmt (push) Successful in 25s
Rust Build / Clippy (push) Successful in 26s
Rust Build / build (push) Successful in 24s
Rust Build / Check (pull_request) Successful in 27s
Rust Build / Test Suite (pull_request) Successful in 26s
Rust Build / build (pull_request) Successful in 26s
Rust Build / Check (push) Successful in 26s
Rust Build / Test Suite (push) Successful in 27s
Rust Build / Rustfmt (pull_request) Successful in 25s
Rust Build / Clippy (pull_request) Successful in 26s

Reviewed-on: #42
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
This commit is contained in:
2025-06-29 17:37:13 +00:00
committed by phoenix
parent 47475639b0
commit f37c445908
6 changed files with 501 additions and 18 deletions

View File

@@ -67,10 +67,7 @@ impl Song {
pub fn song_path(&self) -> Result<String, std::io::Error> {
if self.directory.is_empty() {
return Err(std::io::Error::new(
std::io::ErrorKind::Other,
"Directory does not exist",
));
return Err(std::io::Error::other("Directory does not exist"));
}
let directory = &self.directory;
@@ -86,8 +83,7 @@ impl Song {
Ok(buffer)
} else {
Err(std::io::Error::new(
std::io::ErrorKind::Other,
Err(std::io::Error::other(
"Could not access last character of directory",
))
}
@@ -103,10 +99,7 @@ impl Song {
file.read_to_end(&mut buffer)?;
if buffer.is_empty() {
Err(std::io::Error::new(
std::io::ErrorKind::Other,
"File is empty",
))
Err(std::io::Error::other("File is empty"))
} else {
Ok(buffer)
}