diff --git a/src/config.rs b/src/config.rs index bc7a7e6f6..2fcbc63fa 100644 --- a/src/config.rs +++ b/src/config.rs @@ -461,7 +461,7 @@ pub enum Locale { } impl Locale { - pub fn category(self) -> Option { + pub const fn category(self) -> Option { match self { Locale::En => None, Locale::EnUs => Some(typos_vars::Category::American), @@ -471,7 +471,7 @@ impl Locale { } } - pub fn variants() -> [&'static str; 5] { + pub const fn variants() -> [&'static str; 5] { ["en", "en-us", "en-gb", "en-ca", "en-au"] } } diff --git a/src/dict.rs b/src/dict.rs index ab602d64b..a6413e47f 100644 --- a/src/dict.rs +++ b/src/dict.rs @@ -12,7 +12,7 @@ pub struct BuiltIn { } impl BuiltIn { - pub fn new(locale: crate::config::Locale) -> Self { + pub const fn new(locale: crate::config::Locale) -> Self { Self { locale: locale.category(), }