Clippy and errors
This commit is contained in:
parent
a61f0af4c7
commit
a631040875
|
@ -61,7 +61,8 @@ impl WholeStreamCommand for AutoenvTrust {
|
||||||
.insert(file_to_trust, hasher.finish().to_string());
|
.insert(file_to_trust, hasher.finish().to_string());
|
||||||
|
|
||||||
let config_path = config::default_path_for(&Some(PathBuf::from("nu-env.toml")))?;
|
let config_path = config::default_path_for(&Some(PathBuf::from("nu-env.toml")))?;
|
||||||
fs::write(config_path, toml::to_string(&allowed).unwrap())
|
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");
|
.expect("Couldn't write to toml file");
|
||||||
|
|
||||||
Ok(OutputStream::one(ReturnSuccess::value(
|
Ok(OutputStream::one(ReturnSuccess::value(
|
||||||
|
|
|
@ -78,7 +78,8 @@ impl WholeStreamCommand for AutoenvUnTrust {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
fs::write(config_path, toml::to_string(&allowed).unwrap())
|
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");
|
.expect("Couldn't write to toml file");
|
||||||
|
|
||||||
Ok(OutputStream::one(ReturnSuccess::value(
|
Ok(OutputStream::one(ReturnSuccess::value(
|
||||||
|
|
|
@ -43,7 +43,7 @@ impl DirectorySpecificEnvironment {
|
||||||
{
|
{
|
||||||
return Ok(content.parse::<toml::Value>().or_else(|_| {
|
return Ok(content.parse::<toml::Value>().or_else(|_| {
|
||||||
Err(ShellError::untagged_runtime_error(
|
Err(ShellError::untagged_runtime_error(
|
||||||
"Could not parse .nu-env file. Is it well-formed?",
|
format!("Could not parse {:?}. Is it well-formed?", wdirenv)
|
||||||
))
|
))
|
||||||
})?);
|
})?);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user