Remember to run cargo fmt
- ID
34f9aa4- date
2024-09-04 07:55:15+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
8e58bb2- message
Remember to run `cargo fmt`- changed files
2 files, 17 additions, 12 deletions
Changed files
src/get_image_colors.rs (6976) → src/get_image_colors.rs (6954)
diff --git a/src/get_image_colors.rs b/src/get_image_colors.rs
index 5153ced..cf3e96a 100644
--- a/src/get_image_colors.rs
+++ b/src/get_image_colors.rs
@@ -58,25 +58,22 @@ pub enum GetImageColorsErr {
impl Display for GetImageColorsErr {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
- GetImageColorsErr::IoError(io_error) =>
- write!(f, "{}", io_error),
- GetImageColorsErr::ImageError(image_error) =>
- write!(f, "{}", image_error),
- GetImageColorsErr::GetFormatError(format_error) =>
- write!(f, "{}", format_error),
+ GetImageColorsErr::IoError(io_error) => write!(f, "{}", io_error),
+ GetImageColorsErr::ImageError(image_error) => write!(f, "{}", image_error),
+ GetImageColorsErr::GetFormatError(format_error) => write!(f, "{}", format_error),
}
}
}
impl From<std::io::Error> for GetImageColorsErr {
fn from(e: std::io::Error) -> GetImageColorsErr {
- return GetImageColorsErr::IoError(e)
+ return GetImageColorsErr::IoError(e);
}
}
impl From<image::ImageError> for GetImageColorsErr {
fn from(e: image::ImageError) -> GetImageColorsErr {
- return GetImageColorsErr::ImageError(e)
+ return GetImageColorsErr::ImageError(e);
}
}
@@ -84,13 +81,15 @@ fn get_format(path: &PathBuf) -> Result<ImageFormat, GetImageColorsErr> {
let format = match path.extension() {
Some(ext) => Ok(image::ImageFormat::from_extension(ext)),
None => Err(GetImageColorsErr::GetFormatError(
- "Path has no file extension, so could not determine image format".to_string()
+ "Path has no file extension, so could not determine image format".to_string(),
)),
};
match format {
Ok(Some(format)) => Ok(format),
- Ok(None) => Err(GetImageColorsErr::GetFormatError("Unable to determine image format from file extension".to_string())),
+ Ok(None) => Err(GetImageColorsErr::GetFormatError(
+ "Unable to determine image format from file extension".to_string(),
+ )),
Err(e) => Err(e),
}
}
src/main.rs (9787) → src/main.rs (9855)
diff --git a/src/main.rs b/src/main.rs
index 98041af..d12c086 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -222,7 +222,10 @@ mod tests {
assert_eq!(output.exit_code, 1);
assert_eq!(output.stdout, "");
- assert_eq!(output.stderr, "Unable to determine image format from file extension\n");
+ assert_eq!(
+ output.stderr,
+ "Unable to determine image format from file extension\n"
+ );
}
#[test]
@@ -231,7 +234,10 @@ mod tests {
assert_eq!(output.exit_code, 1);
assert_eq!(output.stdout, "");
- assert_eq!(output.stderr, "Unable to determine image format from file extension\n");
+ assert_eq!(
+ output.stderr,
+ "Unable to determine image format from file extension\n"
+ );
}
#[test]