Skip to content

Commit

Permalink
Merge pull request #1518 from Yamato-Security/787-reduce-clone-search
Browse files Browse the repository at this point in the history
reduce clone in search.rs
  • Loading branch information
YamatoSecurity authored Nov 30, 2024
2 parents 425050b + 9686546 commit 9c3927d
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/timeline/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ impl EventSearch {
let search_target = if case_insensitive_flag {
record.data_string.to_lowercase()
} else {
record.data_string.clone()
record.data_string.to_string()
};
self.filepath = CompactString::from(record.evtx_filepath.as_str());
let search_condition = |keywords: &[String]| -> bool {
Expand All @@ -163,7 +163,7 @@ impl EventSearch {
let converted_key = if case_insensitive_flag {
key.to_lowercase()
} else {
key.clone()
key.to_string()
};
utils::contains_str(&search_target, &converted_key)
})
Expand All @@ -172,7 +172,7 @@ impl EventSearch {
let converted_key = if case_insensitive_flag {
key.to_lowercase()
} else {
key.clone()
key.to_string()
};
utils::contains_str(&search_target, &converted_key)
})
Expand All @@ -192,7 +192,7 @@ impl EventSearch {
channel,
eventid,
recordid,
allfieldinfo_newline_splited.into(),
CompactString::from(allfieldinfo_newline_splited),
self.filepath.clone(),
));
}
Expand Down Expand Up @@ -238,7 +238,7 @@ impl EventSearch {
channel,
eventid,
recordid,
allfieldinfo_newline_splited.into(),
CompactString::from(allfieldinfo_newline_splited),
self.filepath.clone(),
));
}
Expand Down Expand Up @@ -463,27 +463,27 @@ pub fn search_result_dsp_msg(
let mut detect_info = DetectInfo::default();
detect_info.ext_field.push((
CompactString::from("Timestamp"),
Profile::Timestamp(timestamp.clone().into()),
Profile::Timestamp(timestamp.into()),
));
detect_info.ext_field.push((
CompactString::from("Hostname"),
Profile::Computer(hostname.clone().into()),
Profile::Computer(hostname.into()),
));
detect_info.ext_field.push((
CompactString::from("Channel"),
Profile::Channel(abbr_channel.clone().into()),
Profile::Channel(abbr_channel.into()),
));
detect_info.ext_field.push((
CompactString::from("Event ID"),
Profile::EventID(event_id.clone().into()),
Profile::EventID(event_id.into()),
));
detect_info.ext_field.push((
CompactString::from("Record ID"),
Profile::RecordID(record_id.clone().into()),
Profile::RecordID(record_id.into()),
));
detect_info.ext_field.push((
CompactString::from("EventTitle"),
Profile::Literal(event_title.clone().into()),
Profile::Literal(event_title.into()),
));
detect_info.ext_field.push((
CompactString::from("AllFieldInfo"),
Expand Down

0 comments on commit 9c3927d

Please sign in to comment.