From b9c170d359ef3e5e458adf8eac02120de60b6103 Mon Sep 17 00:00:00 2001 From: Sam Hedin Date: Thu, 25 Jun 2020 16:32:01 +0200 Subject: [PATCH] Clippy... again --- crates/nu-cli/src/commands/autoenv_trust.rs | 9 ++++++--- crates/nu-cli/src/commands/autoenv_untrust.rs | 9 ++++++--- crates/nu-cli/src/env/directory_specific_environment.rs | 7 ++++--- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/crates/nu-cli/src/commands/autoenv_trust.rs b/crates/nu-cli/src/commands/autoenv_trust.rs index 73afb1c05..421e977d7 100644 --- a/crates/nu-cli/src/commands/autoenv_trust.rs +++ b/crates/nu-cli/src/commands/autoenv_trust.rs @@ -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), diff --git a/crates/nu-cli/src/commands/autoenv_untrust.rs b/crates/nu-cli/src/commands/autoenv_untrust.rs index fafd19c9e..01f640c41 100644 --- a/crates/nu-cli/src/commands/autoenv_untrust.rs +++ b/crates/nu-cli/src/commands/autoenv_untrust.rs @@ -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), diff --git a/crates/nu-cli/src/env/directory_specific_environment.rs b/crates/nu-cli/src/env/directory_specific_environment.rs index b362f1c24..860d2ac7f 100644 --- a/crates/nu-cli/src/env/directory_specific_environment.rs +++ b/crates/nu-cli/src/env/directory_specific_environment.rs @@ -42,9 +42,10 @@ impl DirectorySpecificEnvironment { == Some(&hasher.finish().to_string()) { return Ok(content.parse::().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(