Simplify impl FromIterator for Value::Array, and make it look consistent with the rest of the From<Collection> impls

This commit is contained in:
Árpád Goretity 2018-01-21 09:21:44 +01:00
parent 75ffe41476
commit 4864795d5c

View File

@ -261,8 +261,6 @@ impl<T: Into<Value>> ::std::iter::FromIterator<T> for Value {
/// # }
/// ```
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self {
let vec: Vec<Value> = iter.into_iter().map(|x| x.into()).collect();
Value::Array(vec)
Value::Array(iter.into_iter().map(Into::into).collect())
}
}