summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHubert Figuière <hub@figuiere.net>2024-05-11 19:04:33 -0400
committerHubert Figuière <hub@figuiere.net>2024-05-11 21:39:25 -0400
commit259730269c44895e7fc5620552719a5da80201d1 (patch)
treeac55dab2df585d36acd638f9b89a891bf726ab45
parentf787bfd2065497f6cfc1786ef9aa7e0887895bc0 (diff)
clippy: Fix some warningsHEADmaster
Signed-off-by: Hubert Figuière <hub@figuiere.net>
-rw-r--r--src/identify.rs1
-rw-r--r--src/mosaic.rs32
-rw-r--r--src/tiff/exif.rs12
3 files changed, 24 insertions, 21 deletions
diff --git a/src/identify.rs b/src/identify.rs
index aa9d5bd..6d8f33f 100644
--- a/src/identify.rs
+++ b/src/identify.rs
@@ -115,7 +115,6 @@ pub(crate) fn type_for_mime_type(mime: &str) -> Option<Type> {
MIME_TO_TYPE.get(mime).cloned()
}
-
/// Return the `Type` based on the content of the file.
pub(crate) fn type_for_content(content: &mut View) -> Result<Option<Type>> {
use crate::Type::*;
diff --git a/src/mosaic.rs b/src/mosaic.rs
index c5b9a2f..cbac4c4 100644
--- a/src/mosaic.rs
+++ b/src/mosaic.rs
@@ -2,7 +2,7 @@
/*
* libopenraw - mosaic.rs
*
- * Copyright (C) 2023 Hubert Figuière
+ * Copyright (C) 2023-2024 Hubert Figuière
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -84,19 +84,23 @@ pub enum Pattern {
Grbg,
}
-impl ToString for Pattern {
- /// The `ToString` conversion for the pattern will print a string of
- /// the pattern colour filters left - right & top - bottom
- fn to_string(&self) -> String {
- match *self {
- Self::Empty => "NONE".into(),
- Self::Rggb => "RGGB".into(),
- Self::Gbrg => "GBRG".into(),
- Self::Bggr => "BGGR".into(),
- Self::Grbg => "GRBG".into(),
- Self::NonRgb22(_) => "NON_RGB22".into(),
- //p.iter().map(|c| c.to_char()).collect(),
- }
+impl std::fmt::Display for Pattern {
+ /// `Display` will print a string of the pattern colour filters
+ /// left - right & top - bottom
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ write!(
+ f,
+ "{}",
+ match *self {
+ Self::Empty => "NONE",
+ Self::Rggb => "RGGB",
+ Self::Gbrg => "GBRG",
+ Self::Bggr => "BGGR",
+ Self::Grbg => "GRBG",
+ Self::NonRgb22(_) => "NON_RGB22",
+ //p.iter().map(|c| c.to_char()).collect(),
+ }
+ )
}
}
diff --git a/src/tiff/exif.rs b/src/tiff/exif.rs
index 629f4e8..4bf3f80 100644
--- a/src/tiff/exif.rs
+++ b/src/tiff/exif.rs
@@ -297,9 +297,9 @@ impl ExifValue for Rational {
}
}
-impl ToString for Rational {
- fn to_string(&self) -> String {
- format!("{}/{}", self.num, self.denom)
+impl std::fmt::Display for Rational {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ write!(f, "{}/{}", self.num, self.denom)
}
}
@@ -361,9 +361,9 @@ impl ExifValue for SRational {
}
}
-impl ToString for SRational {
- fn to_string(&self) -> String {
- format!("{}/{}", self.num, self.denom)
+impl std::fmt::Display for SRational {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ write!(f, "{}/{}", self.num, self.denom)
}
}