lib: Make pref_strings lowercase
Signed-off-by: Ben Aaron Goldberg <ben@benaaron.dev>
This commit is contained in:
parent
680bbd5b2d
commit
63e4f2b8fc
|
@ -78,7 +78,7 @@ pub trait Preference {
|
||||||
/// This is the primary method of creating a `Preference` object from a prefstring. The
|
/// This is the primary method of creating a `Preference` object from a prefstring. The
|
||||||
/// default implementation calls the underlying [`Preference::from_prefstring_bytes()`] method.
|
/// default implementation calls the underlying [`Preference::from_prefstring_bytes()`] method.
|
||||||
fn from_prefstring(prefstring: &str) -> Result<Self, ParseError> where Self: Sized {
|
fn from_prefstring(prefstring: &str) -> Result<Self, ParseError> where Self: Sized {
|
||||||
BASE32_NOPAD.decode(prefstring.as_ref())
|
BASE32_NOPAD.decode(prefstring.to_uppercase().as_bytes())
|
||||||
.map_err(ParseError::Base32Error)
|
.map_err(ParseError::Base32Error)
|
||||||
.and_then(|ps| Self::from_prefstring_bytes(&ps))
|
.and_then(|ps| Self::from_prefstring_bytes(&ps))
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ pub trait Preference {
|
||||||
/// This is the primary method of creating a prefstring from a `Preference` object. The
|
/// This is the primary method of creating a prefstring from a `Preference` object. The
|
||||||
/// default implementation calls the underlying [`Preference::into_prefstring_bytes()`] method.
|
/// default implementation calls the underlying [`Preference::into_prefstring_bytes()`] method.
|
||||||
fn as_prefstring(&self) -> String {
|
fn as_prefstring(&self) -> String {
|
||||||
BASE32_NOPAD.encode(&self.as_prefstring_bytes())
|
BASE32_NOPAD.encode(&self.as_prefstring_bytes()).to_lowercase()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Select a pronoun for today using this Preference's WeightedTable.
|
/// Select a pronoun for today using this Preference's WeightedTable.
|
||||||
|
|
Loading…
Reference in a new issue