From 878d4de6fc097533c7ce0953acb07515a0592508 Mon Sep 17 00:00:00 2001 From: Nicolas Hedger Date: Sat, 10 Feb 2024 13:55:18 +0100 Subject: [PATCH] simplify match --- crates/biome_service/src/file_handlers/vue.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/crates/biome_service/src/file_handlers/vue.rs b/crates/biome_service/src/file_handlers/vue.rs index 36973aeaf127..ae5021f5fea3 100644 --- a/crates/biome_service/src/file_handlers/vue.rs +++ b/crates/biome_service/src/file_handlers/vue.rs @@ -78,16 +78,13 @@ fn parse( _ => "", }; - let language = match matches { - Some(captures) => match captures.name("lang") { - Some(lang) => match lang.as_str() { - "ts" => JsFileSource::ts(), - _ => JsFileSource::js_module(), - }, + let language = matches + .and_then(|captures| captures.name("lang")) + .map(|lang| match lang.as_str() { + "ts" => JsFileSource::ts(), _ => JsFileSource::js_module(), - }, - _ => JsFileSource::js_module(), - }; + }) + .unwrap_or(JsFileSource::js_module()); debug!("Parsing file with language {:?}", language);