From 4ac399ecfa978ee1dc466facf49ae0e75d22f102 Mon Sep 17 00:00:00 2001 From: martinfrances107 Date: Wed, 18 Oct 2023 09:05:49 +0100 Subject: [PATCH] Simplification, now using ??. --- plotters/src/style/font/ttf.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/plotters/src/style/font/ttf.rs b/plotters/src/style/font/ttf.rs index 3ace93cd..8087293f 100644 --- a/plotters/src/style/font/ttf.rs +++ b/plotters/src/style/font/ttf.rs @@ -132,16 +132,13 @@ fn load_font_data(face: FontFamily, style: FontStyle) -> FontResult { // Then we need to check if the data cache contains the font data let cache = DATA_CACHE.read().unwrap(); if let Some(data) = cache.get(Borrow::::borrow(&key)) { - let font_ext = data.clone().map(|handle| { + data.clone().map(|handle| { handle .load() .map(FontExt::new) .map_err(|e| FontError::FontLoadError(Arc::new(e))) - })?; + })??; - if font_ext.is_err() { - return font_ext; - } } drop(cache);