From 4d5414a4d7ec0d6244c3045ca586a88bc3de67bf Mon Sep 17 00:00:00 2001 From: DastInDark <2350416+hitenkoku@users.noreply.github.com> Date: Fri, 29 Jul 2022 10:34:42 +0900 Subject: [PATCH] removed unnecessary clone process #165 --- src/detections/message.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/detections/message.rs b/src/detections/message.rs index 3df47032..0a7a6938 100644 --- a/src/detections/message.rs +++ b/src/detections/message.rs @@ -158,15 +158,16 @@ pub fn insert( if exist_detail { profile_converter.insert("%Details%".to_string(), detect_info.detail.to_owned()); } - let mut converted_detect_info = detect_info.clone(); - for (k, v) in &detect_info.ext_field { + let mut tmp_converted_info : HashMap = HashMap::new(); + for (k, v) in detect_info.ext_field.iter() { let converted_reserve_info = convert_profile_reserved_info(v, profile_converter); - converted_detect_info.ext_field.insert( - k.to_owned(), - parse_message(event_record, &converted_reserve_info), - ); + tmp_converted_info.insert(k.to_owned(), + parse_message(event_record, &converted_reserve_info)); } - insert_message(converted_detect_info, time) + for (k, v) in tmp_converted_info { + detect_info.ext_field.insert(k, v); + } + insert_message(detect_info, time) } /// profileで用いられる予約語の情報を変換する関数