Skip to content

Commit

Permalink
index: remove unused iter() function
Browse files Browse the repository at this point in the history
  • Loading branch information
martinvonz committed Feb 10, 2023
1 parent ee336a2 commit 3744ae4
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions lib/src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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")]
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 3744ae4

Please sign in to comment.