refactor: Use is_some_and

This commit is contained in:
FineFindus 2023-06-26 11:59:17 +00:00 • committed by Sophie Herold
parent 1a39751402
commit bc9aff5068
5 changed files with 33 additions and 33 deletions

View file

@ -142,10 +142,12 @@ impl ImageMetadata {
}
pub fn f_number(&self) -> Option<String> {
if let Some(exif) = &self.exif {
if let Some(field) = exif.get_field(exif::Tag::FNumber, exif::In::PRIMARY) {
return Some(format!("ƒ\u{2215}{}", field.display_value()));
}
if let Some(field) = self
.exif
.as_ref()
.and_then(|exif| exif.get_field(exif::Tag::FNumber, exif::In::PRIMARY))
{
return Some(format!("ƒ\u{2215}{}", field.display_value()));
}
None