Skip to content

Commit

Permalink
feat: Const some fns
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed Page committed Mar 30, 2021
1 parent 75ba4ac commit b17f9c3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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"]
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/dict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
Expand Down

0 comments on commit b17f9c3

Please sign in to comment.