Refactor HighlightingAssets::get_syntax to return Result type

This commit is contained in:
Ethan P authored and David Peter committed 2020-05-16 13:44:26 +02:00
1 parent 9c371ed8a2
commit 5aa20c090b
3 files changed
+54 -28

No files matched your search

+4 -1
View File
@@ -164,7 +164,10 @@ impl<'a> InteractivePrinter<'a> {
None
} else {
// Determine the type of syntax for highlighting
let syntax = assets.get_syntax(config.language, input, &config.syntax_mapping);
let syntax = assets
.get_syntax(config.language, input, &config.syntax_mapping)
.unwrap_or_else(|_| assets.syntax_set.find_syntax_plain_text());
Some(HighlightLines::new(syntax, theme))
};