Skip to content

Commit

Permalink
Use enumerate() where apt
Browse files Browse the repository at this point in the history
  • Loading branch information
carllin committed Nov 23, 2018
1 parent 9a9e76c commit 38ce50c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/db_ledger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ impl DbLedger {
I: IntoIterator<Item = &'a Entry>,
{
let default_addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), 0);
let shared_blobs = entries.into_iter().zip(0..).map(|(entry, idx)| {
let shared_blobs = entries.into_iter().enumerate().map(|(entry, idx)| {
entry.to_blob(Some(idx), Some(Pubkey::default()), Some(&default_addr))
});
self.write_shared_blobs(slot, shared_blobs)
Expand Down Expand Up @@ -661,7 +661,7 @@ mod tests {
let num_entries = 8;
let shared_blobs = make_tiny_test_entries(num_entries).to_blobs();

for (b, i) in shared_blobs.iter().zip(0..num_entries) {
for (b, i) in shared_blobs.iter().enumerate() {
b.write().unwrap().set_index(1 << (i * 8)).unwrap();
}

Expand Down
2 changes: 1 addition & 1 deletion src/db_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ mod test {
assert!(gap > 3);
let num_entries = 10;
let shared_blobs = make_tiny_test_entries(num_entries).to_blobs();
for (b, i) in shared_blobs.iter().zip(0..shared_blobs.len() as u64) {
for (b, i) in shared_blobs.iter().enumerate() {
b.write().unwrap().set_index(i * gap).unwrap();
}
let blob_locks: Vec<_> = shared_blobs.iter().map(|b| b.read().unwrap()).collect();
Expand Down

0 comments on commit 38ce50c

Please sign in to comment.