From f904eb2e98a30865207f954184b15b195f41aefc Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Fri, 22 May 2020 11:37:45 +0200 Subject: Replace match with function chaining Signed-off-by: Matthias Beyer --- src/main.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index d12e2ce..4bfea0c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -172,10 +172,7 @@ async fn on_get(req: Request) -> Result, Box> { }; // If we have an extension, we need to serve with the appropriate Content-Type - let mime = match &extension { - Some(ext) => mime_guess::from_ext(&ext).first_raw(), - None => None, - }; + let mime = extension.as_ref().and_then(|ext| mime_guess::from_ext(ext).first_raw()); // /ID. serves a page with javascript which does syntax highlighting, // if the extension/mime is a type associated with a plain-text file type -- cgit v1.2.3