From 1978ae16aad51ba468c3ce2fbaab318f8889569c Mon Sep 17 00:00:00 2001 From: Dirk Rusche Date: Fri, 19 Apr 2024 10:36:38 +0200 Subject: [PATCH] remove unnecessary clones (#224) Signed-off-by: Dirk Rusche --- src/binding/http/deserializer.rs | 4 ++-- src/binding/rdkafka/kafka_consumer_record.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/binding/http/deserializer.rs b/src/binding/http/deserializer.rs index 0b05da1d..21a1c809 100644 --- a/src/binding/http/deserializer.rs +++ b/src/binding/http/deserializer.rs @@ -34,10 +34,10 @@ impl<'a, T: Headers<'a>> BinaryDeserializer for Deserializer<'a, T> { .unwrap()?, )?; - visitor = visitor.set_spec_version(spec_version.clone())?; - let attributes = spec_version.attribute_names(); + visitor = visitor.set_spec_version(spec_version)?; + for (hn, hv) in self.headers.iter().filter(|(hn, _)| { let key = hn.as_str(); SPEC_VERSION_HEADER.ne(key) && key.starts_with("ce-") diff --git a/src/binding/rdkafka/kafka_consumer_record.rs b/src/binding/rdkafka/kafka_consumer_record.rs index f6e514e1..b5671cbe 100644 --- a/src/binding/rdkafka/kafka_consumer_record.rs +++ b/src/binding/rdkafka/kafka_consumer_record.rs @@ -51,10 +51,10 @@ impl BinaryDeserializer for ConsumerRecordDeserializer { })?, )?; - visitor = visitor.set_spec_version(spec_version.clone())?; - let attributes = spec_version.attribute_names(); + visitor = visitor.set_spec_version(spec_version)?; + if let Some(hv) = self.headers.remove(CONTENT_TYPE) { visitor = visitor.set_attribute( "datacontenttype",