summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2020-05-22 11:37:45 +0200
committerMatthias Beyer <mail@beyermatthias.de>2020-05-22 11:38:17 +0200
commitf683ec4ad3e9716623e053a5d8f9fbbf257801ec (patch)
tree29bf0e06f60c75da2361c94fa87309df27d5c8d4
parentf904eb2e98a30865207f954184b15b195f41aefc (diff)
Replace match with function chainingHEADmaster
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--src/main.rs5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs
index 4bfea0c..1863f2d 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -166,10 +166,7 @@ async fn on_get(req: Request<Body>) -> Result<Response<Body>, Box<dyn Error>> {
return Ok(respond_404()?);
}
- let extension = match &Path::new(path).extension() {
- Some(ext) => Some(ext.to_string_lossy()),
- None => None,
- };
+ let extension = Path::new(path).extension().as_ref().map(|e| e.to_string_lossy());
// If we have an extension, we need to serve with the appropriate Content-Type
let mime = extension.as_ref().and_then(|ext| mime_guess::from_ext(ext).first_raw());