diff --git a/Cargo.toml b/Cargo.toml index 2158446..c925a5b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ publish = false [dependencies] petgraph = "^0.5" -nom = "^3" +nom = "^4" lazy_static = "^1.4" fnv = "^1" diff --git a/src/fdo_magic/builtin/magic b/src/fdo_magic/builtin/magic index a1051c4..a03c1aa 100644 Binary files a/src/fdo_magic/builtin/magic and b/src/fdo_magic/builtin/magic differ diff --git a/src/fdo_magic/ruleset.rs b/src/fdo_magic/ruleset.rs index 4ef1872..98d12cc 100644 --- a/src/fdo_magic/ruleset.rs +++ b/src/fdo_magic/ruleset.rs @@ -159,15 +159,9 @@ fn gen_graph(magic_rules: Vec) -> DiGraph Result>, String> { - let tuplevec = from_u8_to_tuple_vec(b).to_result().map_err(|e| e.to_string())?; - let mut res = FnvHashMap::>::default(); - - for x in tuplevec { - res.insert(x.0, gen_graph(x.1)); - } - + let tuplevec = from_u8_to_tuple_vec(b).map_err(|e| e.to_string())?.1; + let res = tuplevec.into_iter().map(|x| (x.0, gen_graph(x.1))).collect(); Ok(res) - } /// Loads the given magic file and outputs a vector of MagicEntry structs