feat: Const some fns

This commit is contained in:
Ed Page 2021-03-01 12:27:07 -06:00
parent 75ba4ac535
commit b17f9c3a12
2 changed files with 3 additions and 3 deletions

View file

@ -461,7 +461,7 @@ pub enum Locale {
}
impl Locale {
pub fn category(self) -> Option<typos_vars::Category> {
pub const fn category(self) -> Option<typos_vars::Category> {
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"]
}
}

View file

@ -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(),
}