From 9814eeae30db923bfb839466a43680af65b61df6 Mon Sep 17 00:00:00 2001 From: Patrick Meredith Date: Sat, 24 Aug 2019 19:38:33 -0400 Subject: [PATCH] Remove need for impl Clone on from_bson_bytes_to_value --- src/commands/from_bson.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/commands/from_bson.rs b/src/commands/from_bson.rs index d0f3e75485..bf0d99a4db 100644 --- a/src/commands/from_bson.rs +++ b/src/commands/from_bson.rs @@ -94,17 +94,14 @@ impl std::io::Read for BytesReader { pub fn from_bson_bytes_to_value( bytes: Vec, - tag: impl Into + std::clone::Clone, + tag: impl Into, ) -> bson::DecoderResult> { - let mut out = Vec::new(); + let mut docs = Vec::new(); let mut b_reader = BytesReader::new(bytes); while let Ok(v) = decode_document(&mut b_reader) { - out.push(convert_bson_value_to_nu_value( - &Bson::Document(v), - tag.clone(), - )); + docs.push(Bson::Document(v)); } - Ok(Value::List(out).tagged(tag)) + Ok(convert_bson_value_to_nu_value(&Bson::Array(docs), tag)) } fn from_bson(args: CommandArgs, registry: &CommandRegistry) -> Result { @@ -117,7 +114,7 @@ fn from_bson(args: CommandArgs, registry: &CommandRegistry) -> Result match from_bson_bytes_to_value(vb, span) {