mirror of
https://github.com/sharkdp/bat
synced 2024-11-23 20:33:06 +00: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
1 changed files with 3 additions and 4 deletions
|
@ -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()))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue