Clippy... again

This commit is contained in:
Sam Hedin 2020-06-25 16:32:01 +02:00
parent a631040875
commit b9c170d359
3 changed files with 16 additions and 9 deletions

View File

@ -61,9 +61,12 @@ impl WholeStreamCommand for AutoenvTrust {
.insert(file_to_trust, hasher.finish().to_string());
let config_path = config::default_path_for(&Some(PathBuf::from("nu-env.toml")))?;
let tomlstr = toml::to_string(&allowed).or_else(|_| Err(ShellError::untagged_runtime_error("Couldn't serialize allowed dirs to nu-env.toml")))?;
fs::write(config_path, tomlstr)
.expect("Couldn't write to toml file");
let tomlstr = toml::to_string(&allowed).or_else(|_| {
Err(ShellError::untagged_runtime_error(
"Couldn't serialize allowed dirs to nu-env.toml",
))
})?;
fs::write(config_path, tomlstr).expect("Couldn't write to toml file");
Ok(OutputStream::one(ReturnSuccess::value(
UntaggedValue::string(".nu-env trusted!").into_value(tag),

View File

@ -78,9 +78,12 @@ impl WholeStreamCommand for AutoenvUnTrust {
));
}
let tomlstr = toml::to_string(&allowed).or_else(|_| Err(ShellError::untagged_runtime_error("Couldn't serialize allowed dirs to nu-env.toml")))?;
fs::write(config_path, tomlstr)
.expect("Couldn't write to toml file");
let tomlstr = toml::to_string(&allowed).or_else(|_| {
Err(ShellError::untagged_runtime_error(
"Couldn't serialize allowed dirs to nu-env.toml",
))
})?;
fs::write(config_path, tomlstr).expect("Couldn't write to toml file");
Ok(OutputStream::one(ReturnSuccess::value(
UntaggedValue::string(".nu-env untrusted!").into_value(tag),

View File

@ -42,9 +42,10 @@ impl DirectorySpecificEnvironment {
== Some(&hasher.finish().to_string())
{
return Ok(content.parse::<toml::Value>().or_else(|_| {
Err(ShellError::untagged_runtime_error(
format!("Could not parse {:?}. Is it well-formed?", wdirenv)
))
Err(ShellError::untagged_runtime_error(format!(
"Could not parse {:?}. Is it well-formed?",
wdirenv
)))
})?);
}
return Err(ShellError::untagged_runtime_error(