From 97780f987e7873a8e84435a089672ff958b0327b Mon Sep 17 00:00:00 2001 From: cyqsimon <28627918+cyqsimon@users.noreply.github.com> Date: Thu, 2 Nov 2023 16:33:56 +0800 Subject: [PATCH] `MappingDefModel::into_mapping_list` returns `MappingList` --- build/syntax_mapping.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/build/syntax_mapping.rs b/build/syntax_mapping.rs index 850b25b4..b34e6b7d 100644 --- a/build/syntax_mapping.rs +++ b/build/syntax_mapping.rs @@ -42,8 +42,9 @@ struct MappingDefModel { mappings: IndexMap>, } impl MappingDefModel { - fn into_mapping_list(self) -> Vec<(String, MappingTarget)> { - self.mappings + fn into_mapping_list(self) -> MappingList { + let list = self + .mappings .into_iter() .flat_map(|(target, matcher)| { matcher @@ -51,7 +52,8 @@ impl MappingDefModel { .map(|rule| (rule, target.clone())) .collect::>() }) - .collect() + .collect(); + MappingList(list) } } @@ -86,7 +88,7 @@ fn read_all_mappings() -> anyhow::Result { { let toml_string = fs::read_to_string(entry.path())?; let mappings = toml::from_str::(&toml_string)?.into_mapping_list(); - all_mappings.extend(mappings); + all_mappings.extend(mappings.0); } Ok(MappingList(all_mappings))