From 2d8db63a533ae3cee4a132e7d62b9b25b359e3a3 Mon Sep 17 00:00:00 2001 From: Abdo Date: Fri, 12 Jul 2024 14:35:04 +0300 Subject: [PATCH] Fix unused parent tags getting cleared --- rslib/src/tags/mod.rs | 2 +- rslib/src/tags/tree.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rslib/src/tags/mod.rs b/rslib/src/tags/mod.rs index aab335a3d9a..51b091ab8e0 100644 --- a/rslib/src/tags/mod.rs +++ b/rslib/src/tags/mod.rs @@ -56,7 +56,7 @@ fn is_tag_separator(c: char) -> bool { } pub(crate) fn immediate_parent_name_unicase(tag_name: UniCase<&str>) -> Option> { - tag_name.rsplit_once('\x1f').map(|t| t.0).map(UniCase::new) + tag_name.rsplit_once("::").map(|t| t.0).map(UniCase::new) } fn immediate_parent_name_str(tag_name: &str) -> Option<&str> { diff --git a/rslib/src/tags/tree.rs b/rslib/src/tags/tree.rs index f989cb39dbf..32f98d72e4a 100644 --- a/rslib/src/tags/tree.rs +++ b/rslib/src/tags/tree.rs @@ -58,10 +58,10 @@ fn add_missing_parents(tags: &mut Vec) { } fn tags_to_tree(mut tags: Vec) -> TagTreeNode { + add_missing_parents(&mut tags); for tag in &mut tags { tag.name = tag.name.replace("::", "\x1f"); } - add_missing_parents(&mut tags); tags.sort_unstable_by(|a, b| UniCase::new(&a.name).cmp(&UniCase::new(&b.name))); let mut top = TagTreeNode::default(); let mut it = tags.into_iter().peekable();