From cb90b90cbf60c774b6ada77282faecff32540921 Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Fri, 21 May 2021 11:06:53 -0500 Subject: [PATCH] nothing converted to string should return nothing and not fail (#3459) --- crates/nu-command/src/commands/into/string.rs | 1 + crates/nu-command/src/commands/str_/from.rs | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/nu-command/src/commands/into/string.rs b/crates/nu-command/src/commands/into/string.rs index 0b1ca9ae5f..d0c33afca2 100644 --- a/crates/nu-command/src/commands/into/string.rs +++ b/crates/nu-command/src/commands/into/string.rs @@ -140,6 +140,7 @@ pub fn action( let byte_string = InlineShape::format_bytes(*a_filesize, None); byte_string.1 } + Primitive::Nothing => "nothing".to_string(), _ => { return Err(ShellError::unimplemented( "str from for non-numeric primitives", diff --git a/crates/nu-command/src/commands/str_/from.rs b/crates/nu-command/src/commands/str_/from.rs index b3f3fb6128..e23ef2e922 100644 --- a/crates/nu-command/src/commands/str_/from.rs +++ b/crates/nu-command/src/commands/str_/from.rs @@ -132,10 +132,12 @@ pub fn action( let byte_string = InlineShape::format_bytes(*a_filesize, None); byte_string.1 } + Primitive::Nothing => "nothing".to_string(), _ => { - return Err(ShellError::unimplemented( - "str from for non-numeric primitives", - )) + return Err(ShellError::unimplemented(&format!( + "str from for non-numeric primitives {:?}", + prim + ))) } }) .into_value(tag)),