diff --git a/crates/nu-cli/src/commands/autoenv.rs b/crates/nu-cli/src/commands/autoenv.rs index c1fb83f1b3..ac1fcac699 100644 --- a/crates/nu-cli/src/commands/autoenv.rs +++ b/crates/nu-cli/src/commands/autoenv.rs @@ -22,19 +22,16 @@ impl Trusted { pub fn read_trusted() -> Result { let config_path = config::default_path_for(&Some(PathBuf::from("nu-env.toml")))?; - let mut file = match std::fs::OpenOptions::new() + let mut file = std::fs::OpenOptions::new() .read(true) .create(true) .write(true) .open(config_path) - { - Ok(p) => p, - Err(_) => { - return Err(ShellError::untagged_runtime_error( + .or_else(|_| { + Err(ShellError::untagged_runtime_error( "Couldn't open nu-env.toml", - )); - } - }; + )) + })?; let mut doc = String::new(); file.read_to_string(&mut doc)?; diff --git a/crates/nu-cli/src/env/directory_specific_environment.rs b/crates/nu-cli/src/env/directory_specific_environment.rs index 860d2ac7f7..745a830841 100644 --- a/crates/nu-cli/src/env/directory_specific_environment.rs +++ b/crates/nu-cli/src/env/directory_specific_environment.rs @@ -49,7 +49,7 @@ impl DirectorySpecificEnvironment { })?); } return Err(ShellError::untagged_runtime_error( - format!("{:?} is untrusted. Run 'autoenv trust {:?}' and restart nushell to trust it.\nThis needs to be done after each change to the file.\n", wdirenv, wdirenv.parent().unwrap_or_else(|| &Path::new(""))))); + format!("{:?} is untrusted. Run 'autoenv trust {:?}' and restart nushell to trust it.\nThis needs to be done after each change to the file.", wdirenv, wdirenv.parent().unwrap_or_else(|| &Path::new(""))))); } Err(ShellError::untagged_runtime_error("No trusted directories")) }