From 6a89b1b010ad475a523005eebbbaea1499b5b684 Mon Sep 17 00:00:00 2001 From: Arash Outadi Date: Fri, 10 Jul 2020 03:21:13 -0700 Subject: [PATCH] Remove duplicate method (retag) (#2147) --- crates/nu-cli/src/commands/du.rs | 25 ++++++++++++++----------- crates/nu-protocol/src/value.rs | 8 -------- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/crates/nu-cli/src/commands/du.rs b/crates/nu-cli/src/commands/du.rs index 4b3cd6aa85..32a041dd5d 100644 --- a/crates/nu-cli/src/commands/du.rs +++ b/crates/nu-cli/src/commands/du.rs @@ -343,7 +343,7 @@ where let values = vec.into_iter().map(Into::into).collect::>(); UntaggedValue::Table(values) } - .retag(tag) + .into_value(tag) } impl From for Value { @@ -352,17 +352,17 @@ impl From for Value { r.insert( "path".to_string(), - UntaggedValue::path(d.path).retag(&d.tag), + UntaggedValue::path(d.path).into_value(&d.tag), ); r.insert( "apparent".to_string(), - UntaggedValue::bytes(d.size).retag(&d.tag), + UntaggedValue::bytes(d.size).into_value(&d.tag), ); r.insert( "physical".to_string(), - UntaggedValue::bytes(d.blocks).retag(&d.tag), + UntaggedValue::bytes(d.blocks).into_value(&d.tag), ); r.insert("directories".to_string(), value_from_vec(d.dirs, &d.tag)); @@ -376,7 +376,7 @@ impl From for Value { .map(move |e| UntaggedValue::Error(e).into_untagged_value()) .collect::>(), ) - .retag(&d.tag); + .into_value(&d.tag); r.insert("errors".to_string(), v); } @@ -394,30 +394,33 @@ impl From for Value { r.insert( "path".to_string(), - UntaggedValue::path(f.path).retag(&f.tag), + UntaggedValue::path(f.path).into_value(&f.tag), ); r.insert( "apparent".to_string(), - UntaggedValue::bytes(f.size).retag(&f.tag), + UntaggedValue::bytes(f.size).into_value(&f.tag), ); let b = f .blocks .map(UntaggedValue::bytes) .unwrap_or_else(UntaggedValue::nothing) - .retag(&f.tag); + .into_value(&f.tag); r.insert("physical".to_string(), b); r.insert( "directories".to_string(), - UntaggedValue::nothing().retag(&f.tag), + UntaggedValue::nothing().into_value(&f.tag), ); - r.insert("files".to_string(), UntaggedValue::nothing().retag(&f.tag)); + r.insert( + "files".to_string(), + UntaggedValue::nothing().into_value(&f.tag), + ); - UntaggedValue::row(r).retag(&f.tag) + UntaggedValue::row(r).into_value(&f.tag) } } diff --git a/crates/nu-protocol/src/value.rs b/crates/nu-protocol/src/value.rs index c2315e2e8e..c192d29cc5 100644 --- a/crates/nu-protocol/src/value.rs +++ b/crates/nu-protocol/src/value.rs @@ -48,14 +48,6 @@ pub enum UntaggedValue { } impl UntaggedValue { - /// Tags an UntaggedValue so that it can become a Value - pub fn retag(self, tag: impl Into) -> Value { - Value { - value: self, - tag: tag.into(), - } - } - /// Get the corresponding descriptors (column names) associated with this value pub fn data_descriptors(&self) -> Vec { match self {