From b96451bee56d040140a171ac95bd4e5d97b970b0 Mon Sep 17 00:00:00 2001 From: phoenix Date: Mon, 20 Oct 2025 20:55:07 -0400 Subject: [PATCH] tsk-44: Code formatting --- src/detection/coverart.rs | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/src/detection/coverart.rs b/src/detection/coverart.rs index b978e67..6bd5d01 100644 --- a/src/detection/coverart.rs +++ b/src/detection/coverart.rs @@ -1,21 +1,11 @@ /// Gets the file type of a CoverArt given it's path pub fn file_type(filepath: &str) -> Result { match imghdr::from_file(filepath) { - Ok(Some(imghdr::Type::Jpeg)) => { - Ok(String::from("jpeg")) - } - Ok(Some(imghdr::Type::Png)) => { - Ok(String::from("png")) - } - Ok(None) => { - Err(std::io::Error::other("Image file not supported")) - } - Err(err) => { - Err(err) - } - _ => { - Err(std::io::Error::other("Image file not supported")) - } + Ok(Some(imghdr::Type::Jpeg)) => Ok(String::from("jpeg")), + Ok(Some(imghdr::Type::Png)) => Ok(String::from("png")), + Ok(None) => Err(std::io::Error::other("Image file not supported")), + Err(err) => Err(err), + _ => Err(std::io::Error::other("Image file not supported")), } } @@ -29,7 +19,10 @@ mod tests { match super::file_type(&filepath) { Ok(filetype) => { - assert_eq!(filetype, "png", "The file type of the CoverArt should have been png"); + assert_eq!( + filetype, "png", + "The file type of the CoverArt should have been png" + ); } Err(err) => { assert!(false, "Error: {err:?}");