mirror of
https://github.com/nushell/nushell.git
synced 2025-08-19 06:51:28 +02:00
Silence Rust 1.45 Clippy warnings (#2196)
* Silence Rust 1.45 Clippy warnings dealing with using `map_err()` * Silence false Clippy warning * Fix last Clippy error for unnecessary conversion * Fix `and_then` clippy warnings
This commit is contained in:
@@ -55,7 +55,7 @@ impl DirectorySpecificEnvironment {
|
||||
|
||||
if autoenv::file_is_trusted(&nu_env_file, &content)? {
|
||||
let mut doc: NuEnvDoc = toml::de::from_slice(&content)
|
||||
.or_else(|e| Err(ShellError::untagged_runtime_error(format!("{:?}", e))))?;
|
||||
.map_err(|e| ShellError::untagged_runtime_error(format!("{:?}", e)))?;
|
||||
|
||||
if let Some(scripts) = doc.scripts.as_ref() {
|
||||
for (k, v) in scripts {
|
||||
@@ -244,11 +244,11 @@ fn value_from_script(cmd: &str) -> Result<String, ShellError> {
|
||||
cmd
|
||||
)));
|
||||
}
|
||||
let response = std::str::from_utf8(&command.stdout[..command.stdout.len()]).or_else(|e| {
|
||||
Err(ShellError::untagged_runtime_error(format!(
|
||||
let response = std::str::from_utf8(&command.stdout[..command.stdout.len()]).map_err(|e| {
|
||||
ShellError::untagged_runtime_error(format!(
|
||||
"Couldn't parse stdout from command {:?}: {:?}",
|
||||
command, e
|
||||
)))
|
||||
))
|
||||
})?;
|
||||
|
||||
Ok(response.trim().to_string())
|
||||
|
Reference in New Issue
Block a user