change from hashmap to hashset and remove unnecessary copy.

This commit is contained in:
ichiichi11
2021-12-04 18:46:11 +09:00
parent 446e540d6f
commit c961c3768c
4 changed files with 28 additions and 26 deletions

View File

@@ -55,7 +55,7 @@ impl Detection {
pub fn parse_rule_files(
level: String,
rulespath: Option<&str>,
fill_ids: RuleFill,
fill_ids: &RuleFill,
) -> Vec<RuleNode> {
// ルールファイルのパースを実行
let mut rulefile_loader = ParseYaml::new();
@@ -274,8 +274,8 @@ fn test_parse_rule_files() {
let level = "informational";
let opt_rule_path = Some("./test_files/rules/level_yaml");
let fill_ids = RuleFill {
no_use_rule: HashMap::from([("".to_string(), true)]),
no_use_rule: std::collections::HashSet::new(),
};
let cole = Detection::parse_rule_files(level.to_owned(), opt_rule_path, fill_ids);
let cole = Detection::parse_rule_files(level.to_owned(), opt_rule_path, &fill_ids);
assert_eq!(5, cole.len());
}