From 755d0e648b32da1af46880e700974ce2ca431b12 Mon Sep 17 00:00:00 2001 From: Jason Gedge Date: Sun, 8 Mar 2020 15:19:07 -0400 Subject: [PATCH] Eliminate some compiler warnings (#1468) - Unnecessary parentheses - Deprecated `description()` method --- crates/nu-cli/src/commands/classified/external.rs | 4 ++-- crates/nu-cli/src/commands/touch.rs | 3 +-- crates/nu-protocol/src/type_shape.rs | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/crates/nu-cli/src/commands/classified/external.rs b/crates/nu-cli/src/commands/classified/external.rs index 9d68310dcb..1e67975824 100644 --- a/crates/nu-cli/src/commands/classified/external.rs +++ b/crates/nu-cli/src/commands/classified/external.rs @@ -680,8 +680,8 @@ fn argument_is_quoted(argument: &str) -> bool { return false; } - ((argument.starts_with('"') && argument.ends_with('"')) - || (argument.starts_with('\'') && argument.ends_with('\''))) + (argument.starts_with('"') && argument.ends_with('"')) + || (argument.starts_with('\'') && argument.ends_with('\'')) } #[allow(unused)] diff --git a/crates/nu-cli/src/commands/touch.rs b/crates/nu-cli/src/commands/touch.rs index 6585360fdd..3fa2c0c7b9 100644 --- a/crates/nu-cli/src/commands/touch.rs +++ b/crates/nu-cli/src/commands/touch.rs @@ -2,7 +2,6 @@ use crate::prelude::*; use nu_errors::ShellError; use nu_protocol::{CallInfo, Signature, SyntaxShape, Value}; use nu_source::Tagged; -use std::error::Error; use std::fs::OpenOptions; use std::path::PathBuf; @@ -48,7 +47,7 @@ fn touch(args: TouchArgs, _context: &RunnablePerItemContext) -> Result Ok(OutputStream::empty()), Err(err) => Err(ShellError::labeled_error( "File Error", - err.description(), + err.to_string(), &args.target.tag, )), } diff --git a/crates/nu-protocol/src/type_shape.rs b/crates/nu-protocol/src/type_shape.rs index c3881ca36f..1341b60315 100644 --- a/crates/nu-protocol/src/type_shape.rs +++ b/crates/nu-protocol/src/type_shape.rs @@ -301,10 +301,10 @@ struct DebugEntry<'a> { impl<'a> PrettyDebug for DebugEntry<'a> { /// Prepare debug entries for pretty-printing fn pretty(&self) -> DebugDocBuilder { - (b::key(match self.key { + b::key(match self.key { Column::String(string) => string.clone(), Column::Value => "".to_string(), - }) + b::delimit("(", self.value.pretty(), ")").into_kind()) + }) + b::delimit("(", self.value.pretty(), ")").into_kind() } }