From 883792fcd054408d60986c64ee431ec639d4e1e4 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Sun, 18 Aug 2024 21:50:32 -0400 Subject: [PATCH] minor: Use slice reference for parser list With the reference we don't need to update the number of entries when we add a parser. Tip taken from nucleo's `case_fold` module via Pascal. --- src/aff/parser.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aff/parser.rs b/src/aff/parser.rs index 2661937..a1f44f3 100644 --- a/src/aff/parser.rs +++ b/src/aff/parser.rs @@ -58,7 +58,7 @@ struct AffLineParser<'aff> { type Parser = for<'aff> fn(&mut AffLineParser<'aff>, &mut Lines<'aff>) -> ParseResult; // These parsers are only used for the `.aff` file's contents. The `.dic` file is handled ad-hoc. -const AFF_PARSERS: [(&str, Parser); 48] = [ +const AFF_PARSERS: &[(&str, Parser)] = &[ ("FLAG", parse_flag_type), // Flags ("FORBIDDENWORD", parse_forbidden_word_flag),