diff options
| author | Nicholas Rodrigues Lordello <[email protected]> | 2023-02-06 20:47:28 +0000 |
|---|---|---|
| committer | Nicholas Rodrigues Lordello <[email protected]> | 2023-02-06 20:47:28 +0000 |
| commit | 73792f35da2910620c832dfb0873212cd5af7b33 (patch) | |
| tree | 451fa4e4739311a1ba2daa1b2fd72f31c3aa2588 /src/mnemonic/language.rs | |
| parent | d8496d150db33f4bab4d4c9e0162d65b071aef74 (diff) | |
More idiomatic format strings, version bumps
Diffstat (limited to 'src/mnemonic/language.rs')
| -rw-r--r-- | src/mnemonic/language.rs | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/mnemonic/language.rs b/src/mnemonic/language.rs index c15101c..7c9fea9 100644 --- a/src/mnemonic/language.rs +++ b/src/mnemonic/language.rs @@ -8,8 +8,10 @@ use std::{ }; /// The mnemonic langage used to select the word list. -#[derive(Clone, Copy, Debug)] +#[derive(Clone, Copy, Debug, Default)] pub enum Language { + // TODO(nlordell): Read the default language from the system locale. + #[default] English, // TODO(nlordell): Support more languages. Note that this is not necessarily // trivial as some have specific considerations (like 'ñ' being equivalent @@ -46,13 +48,6 @@ impl Language { } } -impl Default for Language { - fn default() -> Self { - // TODO(nlordell): Read the default language from the system locale. - Language::English - } -} - impl Display for Language { fn fmt(&self, f: &mut Formatter) -> fmt::Result { f.write_str(match self { @@ -67,7 +62,7 @@ impl FromStr for Language { fn from_str(s: &str) -> Result<Self> { Ok(match s.to_lowercase().as_str() { "english" => Language::English, - _ => bail!("unsupported language '{}'", s), + _ => bail!("unsupported language '{s}'"), }) } } |
