Skip to content

Commit

Permalink
Redo file-function pair collection
Browse files Browse the repository at this point in the history
  • Loading branch information
adpaco-aws committed Oct 1, 2024
1 parent 4b7e294 commit 91ed88e
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions tools/kani-cov/src/merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! This module includes the implementation of the `merge` subcommand.

use std::{
collections::HashMap,
collections::{HashMap, HashSet},
fs::{File, OpenOptions},
io::{BufReader, BufWriter},
path::PathBuf,
Expand Down Expand Up @@ -132,19 +132,13 @@ fn save_combined_results(

/// All function names appearing in raw coverage results
fn function_names_from_results(results: &[CoverageResults]) -> Vec<(String, String)> {
let mut file_function_pairs = vec![];
let mut file_function_pairs = HashSet::new();
for result in results {
let files = result.data.keys().cloned();
for file in files {
let checks = result.data.get(&file).unwrap();
for (file, checks) in &result.data {
for check in checks {
let function = check.function.clone();
let file_function = (file.clone(), function);
if !file_function_pairs.contains(&file_function) {
file_function_pairs.push(file_function);
}
file_function_pairs.insert((file.clone(), check.function.clone()));
}
}
}
file_function_pairs
file_function_pairs.into_iter().collect()
}

0 comments on commit 91ed88e

Please sign in to comment.