diff --git a/crates/nu-engine/src/eval.rs b/crates/nu-engine/src/eval.rs index 3661c05579..cd02f28cf3 100644 --- a/crates/nu-engine/src/eval.rs +++ b/crates/nu-engine/src/eval.rs @@ -182,9 +182,6 @@ pub fn redirect_env(engine_state: &EngineState, caller_stack: &mut Stack, callee } } -/// Eval external expression -/// -/// It returns PipelineData with a boolean flag, indicate that if the external runs to failed. #[allow(clippy::too_many_arguments)] fn eval_external( engine_state: &EngineState, diff --git a/crates/nu-json/src/util.rs b/crates/nu-json/src/util.rs index 8fa35d429a..5f470219f7 100644 --- a/crates/nu-json/src/util.rs +++ b/crates/nu-json/src/util.rs @@ -59,10 +59,6 @@ where Ok(Some(self.ch[idx])) } - // pub fn peek_next_or_null(&mut self, idx: usize) -> Result { - // Ok(try!(self.peek_next(idx)).unwrap_or(b'\x00')) - // } - pub fn peek(&mut self) -> Result> { self.peek_next(0) } @@ -157,15 +153,6 @@ pub struct ParseNumber> { result: Vec, } -// macro_rules! try_or_invalid { -// ($e:expr) => { -// match $e { -// Some(v) => v, -// None => { return Err(Error::Syntax(ErrorCode::InvalidNumber, 0, 0)); } -// } -// } -// } - impl> ParseNumber { #[inline] pub fn new(iter: Iter) -> Self { diff --git a/crates/nu-protocol/src/pipeline_data.rs b/crates/nu-protocol/src/pipeline_data.rs index 9548386fcd..3e57efd07c 100644 --- a/crates/nu-protocol/src/pipeline_data.rs +++ b/crates/nu-protocol/src/pipeline_data.rs @@ -616,7 +616,6 @@ impl PipelineData { // to create the table value that will be printed in the terminal let config = engine_state.get_config(); - // let stdout = std::io::stdout(); if let PipelineData::ExternalStream { stdout: stream, @@ -626,12 +625,6 @@ impl PipelineData { } = self { return print_if_stream(stream, stderr_stream, to_stderr, exit_code); - /* - if let Ok(exit_code) = print_if_stream(stream, stderr_stream, to_stderr, exit_code) { - return Ok(exit_code); - } - return Ok(0); - */ } if let Some(decl_id) = engine_state.find_decl("table".as_bytes(), &[]) { diff --git a/crates/nu-system/src/windows.rs b/crates/nu-system/src/windows.rs index 7e293aa69a..9bd89784d3 100644 --- a/crates/nu-system/src/windows.rs +++ b/crates/nu-system/src/windows.rs @@ -757,10 +757,7 @@ fn get_proc_env(params: &T, handle: HANDLE) -> Vec< fn get_cwd(params: &T, handle: HANDLE) -> PathBuf { match params.get_cwd(handle) { Ok(buffer) => unsafe { PathBuf::from(null_terminated_wchar_to_string(buffer.as_slice())) }, - Err(_e) => { - // sysinfo_debug!("get_cwd failed to get data: {}", _e); - PathBuf::new() - } + Err(_e) => PathBuf::new(), } } @@ -988,8 +985,6 @@ fn get_name(psid: PSID) -> Option<(String, String)> { #[cfg_attr(tarpaulin, skip)] fn from_wide_ptr(ptr: *const u16) -> String { - // use std::ffi::OsString; - // use std::os::windows::ffi::OsStringExt; unsafe { assert!(!ptr.is_null()); let len = (0..std::isize::MAX) @@ -1013,18 +1008,11 @@ impl ProcessInfo { /// Name of command pub fn name(&self) -> String { - // self.command() - // .split(' ') - // .collect::>() - // .first() - // .map(|x| x.to_string()) - // .unwrap_or_default() self.command.clone() } /// Full name of command, with arguments pub fn command(&self) -> String { - // self.command.clone() self.cmd.join(" ") } diff --git a/crates/nu-table/src/nu_protocol_table.rs b/crates/nu-table/src/nu_protocol_table.rs index 5006ad3c23..8ec6b67d3c 100644 --- a/crates/nu-table/src/nu_protocol_table.rs +++ b/crates/nu-table/src/nu_protocol_table.rs @@ -179,11 +179,6 @@ fn build_map( } } - // if last_val.is_some() && map.is_empty() { - // let val = nu_protocol_value_to_json(last_val.unwrap()); - // return serde_json::Value::Array(vec![val]); - // } - map } diff --git a/crates/nu-test-support/src/commands.rs b/crates/nu-test-support/src/commands.rs index 0206c5792b..bdc7808b4a 100644 --- a/crates/nu-test-support/src/commands.rs +++ b/crates/nu-test-support/src/commands.rs @@ -1,57 +1,3 @@ -// use nu_protocol::{ -// ast::{Expr, Expression}, -// Span, Spanned, Type, -// }; - -// pub struct ExternalBuilder { -// name: String, -// args: Vec, -// } - -// impl ExternalBuilder { -// pub fn for_name(name: &str) -> ExternalBuilder { -// ExternalBuilder { -// name: name.to_string(), -// args: vec![], -// } -// } - -// pub fn arg(&mut self, value: &str) -> &mut Self { -// self.args.push(value.to_string()); -// self -// } - -// pub fn build(&mut self) -> ExternalCommand { -// let mut path = crate::fs::binaries(); -// path.push(&self.name); - -// let name = Spanned { -// item: path.to_string_lossy().to_string(), -// span: Span::new(0, 0), -// }; - -// let args = self -// .args -// .iter() -// .map(|arg| Expression { -// expr: Expr::String(arg.to_string()), -// span: Span::new(0, 0), -// ty: Type::Unknown, -// custom_completion: None, -// }) -// .collect::>(); - -// ExternalCommand { -// name: name.to_string(), -// name_tag: Tag::unknown(), -// args: ExternalArgs { -// list: args, -// span: name.span, -// }, -// } -// } -// } - use std::{ io::Read, process::{Command, Stdio},