forked from katzen-cafe/iowo
chore: appease clippy
This commit is contained in:
parent
c4207af8da
commit
de9ca81b65
2 changed files with 9 additions and 6 deletions
|
@ -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))),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue