mirror of
https://github.com/sharkdp/bat.git
synced 2025-09-01 19:02:22 +01:00
HighlightingAssets: Make .syntaxes() and syntax_for_file_name() failable
Or rather, introduce new versions of these methods and deprecate the old ones. This is preparation to enable robust and user-friendly support for lazy-loading. With lazy-loading, we don't know if the SyntaxSet is valid until after we try to use it, so wherever we try to use it, we need to return a Result. See discussion about panics in #1747.
This commit is contained in:
@@ -26,7 +26,7 @@ fn no_duplicate_extensions() {
|
||||
|
||||
let mut extensions = HashSet::new();
|
||||
|
||||
for syntax in assets.syntaxes() {
|
||||
for syntax in assets.get_syntaxes().expect("this is a #[test]") {
|
||||
for extension in &syntax.file_extensions {
|
||||
assert!(
|
||||
KNOWN_EXCEPTIONS.contains(&extension.as_str()) || extensions.insert(extension),
|
||||
|
Reference in New Issue
Block a user