mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-22 00:51:11 -05:00
feat: Const some fns
This commit is contained in:
parent
75ba4ac535
commit
b17f9c3a12
2 changed files with 3 additions and 3 deletions
|
@ -461,7 +461,7 @@ pub enum Locale {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Locale {
|
impl Locale {
|
||||||
pub fn category(self) -> Option<typos_vars::Category> {
|
pub const fn category(self) -> Option<typos_vars::Category> {
|
||||||
match self {
|
match self {
|
||||||
Locale::En => None,
|
Locale::En => None,
|
||||||
Locale::EnUs => Some(typos_vars::Category::American),
|
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"]
|
["en", "en-us", "en-gb", "en-ca", "en-au"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ pub struct BuiltIn {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BuiltIn {
|
impl BuiltIn {
|
||||||
pub fn new(locale: crate::config::Locale) -> Self {
|
pub const fn new(locale: crate::config::Locale) -> Self {
|
||||||
Self {
|
Self {
|
||||||
locale: locale.category(),
|
locale: locale.category(),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue