From 90f6b6aedf3b6baeca76ec44972ec8134ffe08b3 Mon Sep 17 00:00:00 2001 From: JT <547158+jntrnr@users.noreply.github.com> Date: Fri, 4 Feb 2022 14:51:36 -0500 Subject: [PATCH] Simplify describe (#933) --- .../nu-command/src/core_commands/describe.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/crates/nu-command/src/core_commands/describe.rs b/crates/nu-command/src/core_commands/describe.rs index 4c9ec4f9c8..419b1a6d82 100644 --- a/crates/nu-command/src/core_commands/describe.rs +++ b/crates/nu-command/src/core_commands/describe.rs @@ -1,6 +1,8 @@ use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; -use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Value}; +use nu_protocol::{ + Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Value, +}; #[derive(Clone)] pub struct Describe; @@ -20,7 +22,7 @@ impl Command for Describe { fn run( &self, - engine_state: &EngineState, + _engine_state: &EngineState, _stack: &mut Stack, call: &Call, input: PipelineData, @@ -32,13 +34,12 @@ impl Command for Describe { None, )) } else { - input.map( - move |x| Value::String { - val: x.get_type().to_string(), - span: head, - }, - engine_state.ctrlc.clone(), - ) + let value = input.into_value(call.head); + Ok(Value::String { + val: value.get_type().to_string(), + span: head, + } + .into_pipeline_data()) } }