chore: appease clippy

This commit is contained in:
multisn8 2024-01-20 21:47:33 +01:00
parent c4207af8da
commit de9ca81b65
Signed by untrusted user: multisamplednight
GPG key ID: 6D525AA147CBDAE2
2 changed files with 9 additions and 6 deletions

View file

@ -40,10 +40,13 @@ pub(super) fn find_config_file() -> Result<PathBuf, ConfigError> {
impl Configs {
pub fn read(p: PathBuf) -> Result<Self, ConfigError> {
match p.extension().map(|v| v.to_str().unwrap()) {
match p
.extension()
.map(|v| v.to_str().expect("config path to be UTF-8"))
{
Some("ron") => Ok(serde_json::from_str(&fs::read_to_string(p)?)?),
Some("json") => Ok(ron::from_str(&fs::read_to_string(p)?)?),
e => Err(ConfigError::UnknownExtension(e.map(|v| v.to_owned()))),
e => Err(ConfigError::UnknownExtension(e.map(str::to_string))),
}
}
}