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:
@@ -20,23 +20,23 @@ impl Default for AccessLevel {
|
||||
}
|
||||
|
||||
pub fn default_level() -> AccessLevel {
|
||||
return AccessLevel {
|
||||
AccessLevel {
|
||||
id: -1,
|
||||
level: String::from("Public"),
|
||||
song_id: -1,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
pub fn private_level() -> AccessLevel {
|
||||
return AccessLevel {
|
||||
AccessLevel {
|
||||
id: -1,
|
||||
level: String::from("Private"),
|
||||
song_id: -1,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
impl AccessLevel {
|
||||
pub fn _to_json(&self) -> Result<String, serde_json::Error> {
|
||||
return serde_json::to_string_pretty(&self);
|
||||
serde_json::to_string_pretty(&self)
|
||||
}
|
||||
}
|
||||
|
@@ -16,12 +16,8 @@ impl CoverArt {
|
||||
let mut file = std::fs::File::open(path)?;
|
||||
let mut buffer = Vec::new();
|
||||
match file.read_to_end(&mut buffer) {
|
||||
Ok(_) => {
|
||||
return Ok(buffer);
|
||||
}
|
||||
Err(err) => {
|
||||
return Err(err);
|
||||
}
|
||||
Ok(_) => Ok(buffer),
|
||||
Err(err) => Err(err),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -26,6 +26,6 @@ impl Default for LoginResult {
|
||||
|
||||
impl LoginResult {
|
||||
pub fn _to_json(&self) -> Result<String, serde_json::Error> {
|
||||
return serde_json::to_string_pretty(&self);
|
||||
serde_json::to_string_pretty(&self)
|
||||
}
|
||||
}
|
||||
|
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