index: remove unused iter() function

This commit is contained in:
Martin von Zweigbergk 2023-02-10 09:58:52 -08:00 committed by Martin von Zweigbergk
parent ee336a2e45
commit 3744ae4508

View file

@ -134,10 +134,6 @@ impl<'a> IndexRef<'a> {
}
}
pub fn iter(&self) -> impl Iterator<Item = IndexEntry<'a>> + '_ {
(0..self.num_commits()).map(|pos| self.entry_by_pos(IndexPosition(pos)))
}
pub fn walk_revs(&self, wanted: &[CommitId], unwanted: &[CommitId]) -> RevWalk<'a> {
match self {
IndexRef::Readonly(index) => index.walk_revs(wanted, unwanted),
@ -1767,7 +1763,6 @@ mod tests {
assert!(index.entry_by_id(&CommitId::from_hex("000000")).is_none());
assert!(index.entry_by_id(&CommitId::from_hex("aaa111")).is_none());
assert!(index.entry_by_id(&CommitId::from_hex("ffffff")).is_none());
assert_eq!(index.iter().collect_vec(), vec![]);
}
#[test_case(false; "memory")]
@ -1884,17 +1879,6 @@ mod tests {
let entry_3 = index.entry_by_id(&id_3).unwrap();
let entry_4 = index.entry_by_id(&id_4).unwrap();
let entry_5 = index.entry_by_id(&id_5).unwrap();
assert_eq!(
index.iter().collect_vec(),
vec![
entry_0.clone(),
entry_1.clone(),
entry_2.clone(),
entry_3.clone(),
entry_4.clone(),
entry_5.clone(),
]
);
// Check properties of some entries
assert_eq!(entry_0.pos, IndexPosition(0));
assert_eq!(entry_0.commit_id(), id_0);
@ -1974,7 +1958,6 @@ mod tests {
// Stats are as expected
let stats = index.stats();
assert_eq!(stats.num_commits, 7);
assert_eq!(index.iter().collect_vec().len(), 7);
assert_eq!(stats.num_heads, 1);
assert_eq!(stats.max_generation_number, 2);
assert_eq!(stats.num_merges, 1);