Skip to content

Commit

Permalink
Remove unsafe get_unchecked_mut (#1222)
Browse files Browse the repository at this point in the history
  • Loading branch information
calixteman authored Sep 26, 2024
1 parent 9d7b882 commit c821956
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/covdir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,10 @@ impl CDFileStats {
let total = coverage.len();
let mut lines: Vec<i64> = vec![-1; last_line];
for (line_num, line_count) in coverage.iter() {
let line_count = *line_count;
unsafe {
*lines.get_unchecked_mut((*line_num - 1) as usize) = line_count as i64;
if let Some(line) = lines.get_mut((*line_num - 1) as usize) {
*line = *line_count as i64;
covered += (*line_count > 0) as usize;
}
covered += (line_count > 0) as usize;
}
(total, covered, lines)
}
Expand Down

0 comments on commit c821956

Please sign in to comment.