diff --git a/rslib/src/dbcheck.rs b/rslib/src/dbcheck.rs index ac76b0147..c216800bc 100644 --- a/rslib/src/dbcheck.rs +++ b/rslib/src/dbcheck.rs @@ -243,7 +243,7 @@ impl Collection { let stamp = TimestampMillis::now(); // will rebuild tag list below - let old_tags = self.storage.all_tags_sorted()?; + let old_tags = self.storage.all_tags()?; self.storage.clear_tags()?; let total_notes = self.storage.total_notes()?; diff --git a/rslib/src/storage/tag/mod.rs b/rslib/src/storage/tag/mod.rs index fcd4f2c8a..7620f314f 100644 --- a/rslib/src/storage/tag/mod.rs +++ b/rslib/src/storage/tag/mod.rs @@ -16,6 +16,7 @@ fn row_to_tag(row: &Row) -> Result { } impl SqliteStorage { + /// All tags in the collection, in alphabetical order. pub(crate) fn all_tags(&self) -> Result> { self.db .prepare_cached("select tag, usn, collapsed from tags")? @@ -23,14 +24,6 @@ impl SqliteStorage { .collect() } - /// Get all tags in human form, sorted by name - pub(crate) fn all_tags_sorted(&self) -> Result> { - self.db - .prepare_cached("select tag, usn, collapsed from tags order by tag")? - .query_and_then(NO_PARAMS, row_to_tag)? - .collect() - } - /// Get tag by human name pub(crate) fn get_tag(&self, name: &str) -> Result> { self.db diff --git a/rslib/src/tags.rs b/rslib/src/tags.rs index f01fabcbf..fd6a068f6 100644 --- a/rslib/src/tags.rs +++ b/rslib/src/tags.rs @@ -179,7 +179,7 @@ fn add_child_nodes(tags: &mut Peekable>, parent: &mut impl Collection { pub fn tag_tree(&mut self) -> Result { - let tags = self.storage.all_tags_sorted()?; + let tags = self.storage.all_tags()?; let tree = tags_to_tree(tags); Ok(tree) @@ -256,7 +256,7 @@ impl Collection { /// Update collapse state of existing tags and register tags in old_tags that are parents of those tags pub(crate) fn update_tags_collapse(&self, old_tags: Vec) -> Result<()> { - let new_tags = self.storage.all_tags_sorted()?; + let new_tags = self.storage.all_tags()?; for old in old_tags.into_iter() { for new in new_tags.iter() { if new.name == old.name {