From f48de73236372851d210bdadc0611b158e286787 Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Mon, 31 Oct 2022 10:28:04 -0500 Subject: [PATCH] change str distance to output value::int (#6963) * change str distance to output value::int * update the test --- .gitignore | 4 ++++ crates/nu-command/src/strings/str_/distance.rs | 16 ++++------------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 53d540ca0e..96faa5d460 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,10 @@ debian/nu/ # VSCode's IDE items .vscode/* +# Visual Studio Extension SourceGear Rust items +VSWorkspaceSettings.json +unstable_cargo_features.txt + # Helix configuration folder .helix/* .helix diff --git a/crates/nu-command/src/strings/str_/distance.rs b/crates/nu-command/src/strings/str_/distance.rs index a15a4ff765..5985ea2ba4 100644 --- a/crates/nu-command/src/strings/str_/distance.rs +++ b/crates/nu-command/src/strings/str_/distance.rs @@ -70,12 +70,8 @@ impl Command for SubCommand { vec![Example { description: "get the edit distance between two strings", example: "'nushell' | str distance 'nutshell'", - result: Some(Value::Record { - cols: vec!["distance".to_string()], - vals: vec![Value::Int { - val: 1, - span: Span::test_data(), - }], + result: Some(Value::Int { + val: 1, span: Span::test_data(), }), }] @@ -87,12 +83,8 @@ fn action(input: &Value, args: &Arguments, head: Span) -> Value { match &input { Value::String { val, .. } => { let distance = levenshtein_distance(val, compare_string); - Value::Record { - cols: vec!["distance".to_string()], - vals: vec![Value::Int { - val: distance as i64, - span: head, - }], + Value::Int { + val: distance as i64, span: head, } }