mirror of
https://github.com/sharkdp/bat.git
synced 2024-11-30 03:33:54 +01:00
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.
This commit is contained in:
parent
82f439e715
commit
d989224a8a
@ -212,10 +212,9 @@ impl HighlightingAssets {
|
|||||||
|
|
||||||
let path_syntax = if let Some(path) = path {
|
let path_syntax = if let Some(path) = path {
|
||||||
// If a path was provided, we try and detect the syntax based on extension mappings.
|
// If a path was provided, we try and detect the syntax based on extension mappings.
|
||||||
let absolute_path =
|
match mapping.get_syntax_for(
|
||||||
PathAbs::new(path).map_or_else(|_| path.to_owned(), |p| p.as_path().to_path_buf());
|
PathAbs::new(path).map_or_else(|_| path.to_owned(), |p| p.as_path().to_path_buf()),
|
||||||
|
) {
|
||||||
match mapping.get_syntax_for(absolute_path) {
|
|
||||||
Some(MappingTarget::MapToUnknown) => {
|
Some(MappingTarget::MapToUnknown) => {
|
||||||
Err(Error::UndetectedSyntax(path.to_string_lossy().into()))
|
Err(Error::UndetectedSyntax(path.to_string_lossy().into()))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user