From 74ffe7f688fc8e0a44112d19fc8120326a2a165b Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Sun, 12 Mar 2023 11:17:33 -0700 Subject: [PATCH] index: remove num_commits() from API --- lib/src/default_index_store.rs | 16 ++++++++-------- lib/src/index.rs | 2 -- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/src/default_index_store.rs b/lib/src/default_index_store.rs index 4e5db7cac..29297256d 100644 --- a/lib/src/default_index_store.rs +++ b/lib/src/default_index_store.rs @@ -679,6 +679,10 @@ impl MutableIndexImpl { pub fn stats(&self) -> IndexStats { CompositeIndex(self).stats() } + + pub fn num_commits(&self) -> u32 { + CompositeIndex(self).num_commits() + } } impl Index for MutableIndexImpl { @@ -686,10 +690,6 @@ impl Index for MutableIndexImpl { self } - fn num_commits(&self) -> u32 { - CompositeIndex(self).num_commits() - } - fn commit_id_to_pos(&self, commit_id: &CommitId) -> Option { CompositeIndex(self).commit_id_to_pos(commit_id) } @@ -1752,6 +1752,10 @@ impl ReadonlyIndexImpl { pub fn stats(&self) -> IndexStats { CompositeIndex(self).stats() } + + pub fn num_commits(&self) -> u32 { + CompositeIndex(self).num_commits() + } } impl Index for ReadonlyIndexImpl { @@ -1759,10 +1763,6 @@ impl Index for ReadonlyIndexImpl { self } - fn num_commits(&self) -> u32 { - CompositeIndex(self).num_commits() - } - fn commit_id_to_pos(&self, commit_id: &CommitId) -> Option { CompositeIndex(self).commit_id_to_pos(commit_id) } diff --git a/lib/src/index.rs b/lib/src/index.rs index dc1ad91d7..ce6fb0c58 100644 --- a/lib/src/index.rs +++ b/lib/src/index.rs @@ -48,8 +48,6 @@ pub trait IndexStore: Send + Sync + Debug { pub trait Index { fn as_any(&self) -> &dyn Any; - fn num_commits(&self) -> u32; - fn commit_id_to_pos(&self, commit_id: &CommitId) -> Option; fn shortest_unique_commit_id_prefix_len(&self, commit_id: &CommitId) -> usize;