Skip to content

Commit

Permalink
stats: add implementation comment about assert
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
jqnatividad committed May 25, 2023
1 parent d669f3a commit e3508be
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/cmd/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,8 @@ impl Args {
};
});
}
// assert hints the compiler that the length of results is the same as records
// so it doesn't have to bounds check records index access in the loop below
assert!(results.len() == records.len());
for (i, recv) in results.into_iter().enumerate() {
records[i] = unsafe { recv.recv().unwrap_unchecked() };
Expand Down

0 comments on commit e3508be

Please sign in to comment.