From 090ea9d48665c4a8f319a497746161643d4052b7 Mon Sep 17 00:00:00 2001 From: Rob Wong Date: Sun, 20 Aug 2023 22:34:28 -0600 Subject: [PATCH] chore: use mut amount in dd --- rust/src/adapter/datadog_formatter/mod.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/rust/src/adapter/datadog_formatter/mod.rs b/rust/src/adapter/datadog_formatter/mod.rs index c8285c1..0980729 100644 --- a/rust/src/adapter/datadog_formatter/mod.rs +++ b/rust/src/adapter/datadog_formatter/mod.rs @@ -69,14 +69,13 @@ impl Span { pub fn add_allocation(&mut self, amount: u32) { let key = "allocation".to_string(); + let mut amount = amount; if let Some(alloc) = self.meta.get(key.as_str()) { if let Ok(v) = alloc.parse::() { - let sum_amount = v + amount; - self.meta.insert(key, sum_amount.to_string()); + amount = v + amount; } - } else { - self.meta.insert(key, amount.to_string()); } + self.meta.insert(key, amount.to_string()); } pub fn add_tag(&mut self, tag: String) {