Remove duplicate method (retag) (#2147)

This commit is contained in:
Arash Outadi 2020-07-10 03:21:13 -07:00 committed by GitHub
parent b1b93931cb
commit 6a89b1b010
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 19 deletions

View File

@ -343,7 +343,7 @@ where
let values = vec.into_iter().map(Into::into).collect::<Vec<Value>>();
UntaggedValue::Table(values)
}
.retag(tag)
.into_value(tag)
}
impl From<DirInfo> for Value {
@ -352,17 +352,17 @@ impl From<DirInfo> 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<DirInfo> for Value {
.map(move |e| UntaggedValue::Error(e).into_untagged_value())
.collect::<Vec<Value>>(),
)
.retag(&d.tag);
.into_value(&d.tag);
r.insert("errors".to_string(), v);
}
@ -394,30 +394,33 @@ impl From<FileInfo> 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)
}
}

View File

@ -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<Tag>) -> Value {
Value {
value: self,
tag: tag.into(),
}
}
/// Get the corresponding descriptors (column names) associated with this value
pub fn data_descriptors(&self) -> Vec<String> {
match self {