From d989224a8a5bd6a4a1bbc54ff7b63a813b27979c Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Thu, 16 Sep 2021 17:02:18 +0200 Subject: [PATCH] HighlightingAssets: Inline absolute_path Its name is confusing, because it does not always hold an absolute path. Get rid of this problem by inlining it. --- src/assets.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/assets.rs b/src/assets.rs index 5b166d10..d72c0a42 100644 --- a/src/assets.rs +++ b/src/assets.rs @@ -212,10 +212,9 @@ impl HighlightingAssets { let path_syntax = if let Some(path) = path { // If a path was provided, we try and detect the syntax based on extension mappings. - let absolute_path = - PathAbs::new(path).map_or_else(|_| path.to_owned(), |p| p.as_path().to_path_buf()); - - match mapping.get_syntax_for(absolute_path) { + match mapping.get_syntax_for( + PathAbs::new(path).map_or_else(|_| path.to_owned(), |p| p.as_path().to_path_buf()), + ) { Some(MappingTarget::MapToUnknown) => { Err(Error::UndetectedSyntax(path.to_string_lossy().into())) }