Skip to content

Commit

Permalink
more clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
adpaco-aws committed Oct 4, 2024
1 parent a6abae5 commit 8ea744d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
24 changes: 12 additions & 12 deletions tools/kani-cov/src/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ pub fn output_coverage_results(
let results: Vec<&CovResult> = results
.iter()
.filter(|m| {
if m.region.start.0 as usize == idx && m.region.end.0 as usize == idx {
if m.region.start.0 == idx && m.region.end.0 == idx {
(m.region.end.1 - m.region.start.1 != 1)
&& (m.region.end.1 as usize) < line.len()
&& (m.region.end.1) < line.len()
} else {
true
}
Expand All @@ -154,13 +154,13 @@ pub fn output_coverage_results(
.iter()
.filter(|m| {
m.times_covered == 0
&& m.region.start.0 as usize == idx
&& m.region.end.0 as usize == idx
&& m.region.start.0 == idx
&& m.region.end.0 == idx
})
.flat_map(|m| {
vec![
((m.region.start.1 - 1) as usize, true),
((m.region.end.1 - 1) as usize, false),
((m.region.start.1 - 1), true),
((m.region.end.1 - 1), false),
]
})
.collect();
Expand All @@ -169,20 +169,20 @@ pub fn output_coverage_results(
.iter()
.filter(|m| {
m.times_covered == 0
&& m.region.start.0 as usize == idx
&& m.region.end.0 as usize != idx
&& m.region.start.0 == idx
&& m.region.end.0 != idx
})
.flat_map(|m| vec![((m.region.start.1 - 1) as usize, true)])
.flat_map(|m| vec![((m.region.start.1 - 1), true)])
.collect();
// Escapes for the regions which only finish in this line
let mut closing_escapes: Vec<(usize, bool)> = results
.iter()
.filter(|m| {
m.times_covered == 0
&& m.region.start.0 as usize != idx
&& m.region.end.0 as usize == idx
&& m.region.start.0 != idx
&& m.region.end.0 == idx
})
.flat_map(|m| vec![((m.region.end.1 - 1) as usize, false)])
.flat_map(|m| vec![((m.region.end.1 - 1), false)])
.collect();

// Emit an opening escape if there was a closing one and we
Expand Down
4 changes: 1 addition & 3 deletions tools/kani-cov/src/summary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,7 @@ pub fn line_coverage_info(
let covered_lines = line_status
.iter()
.filter(|s| s.is_some() && s.as_ref().unwrap().0 > 0)
.count()
.try_into()
.unwrap();
.count();
(covered_lines, total_lines)
}

Expand Down

0 comments on commit 8ea744d

Please sign in to comment.