From 2304d63bb3014da33d5b22b1c5befa33ea31b5a8 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Fri, 6 Dec 2019 11:17:39 +0300 Subject: [PATCH] Simplify dc_get_filesuffix_lc --- src/dc_tools.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/dc_tools.rs b/src/dc_tools.rs index 610cc7ce5..493821865 100644 --- a/src/dc_tools.rs +++ b/src/dc_tools.rs @@ -278,11 +278,9 @@ pub fn dc_derive_safe_stem_ext(filename: &str) -> (String, String) { // the returned suffix is lower-case #[allow(non_snake_case)] pub fn dc_get_filesuffix_lc(path_filename: impl AsRef) -> Option { - if let Some(p) = Path::new(path_filename.as_ref()).extension() { - Some(p.to_string_lossy().to_lowercase()) - } else { - None - } + Path::new(path_filename.as_ref()) + .extension() + .map(|p| p.to_string_lossy().to_lowercase()) } /// Returns the `(width, height)` of the given image buffer.