diff --git a/src/cobertura.rs b/src/cobertura.rs index 4a3384791..29e07d18f 100644 --- a/src/cobertura.rs +++ b/src/cobertura.rs @@ -65,8 +65,8 @@ impl CoverageStats { let lines_valid = lines.len() as f64; let branches: Vec> = lines - .into_iter() - .filter_map(|(_, l)| match l { + .into_values() + .filter_map(|l| match l { Line::Branch { conditions, .. } => Some(conditions), Line::Plain { .. } => None, }) diff --git a/src/parser.rs b/src/parser.rs index ecc1a6ef0..ec4c0041f 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -514,7 +514,7 @@ pub fn parse_gcov_gz(gcov_path: &Path) -> Result, Parse let mut gcov: GcovJson = serde_json::from_reader(gz).unwrap(); let mut results = Vec::new(); - if gcov.format_version != "1" { + if gcov.format_version != "1" && gcov.format_version != "2" { error!( "Format version {} is not expected, please file a bug on https://github.com/mozilla/grcov", gcov.format_version diff --git a/src/path_rewriting.rs b/src/path_rewriting.rs index 45759b32a..123d8b72b 100644 --- a/src/path_rewriting.rs +++ b/src/path_rewriting.rs @@ -416,19 +416,11 @@ pub fn rewrite_paths( } } - match filter_option { - Some(true) => { - if !is_covered(&result) { - return None; - } - } - Some(false) => { - if is_covered(&result) { - return None; - } + if let Some(want_covered) = filter_option { + if is_covered(&result) != want_covered { + return None; } - None => (), - }; + } Some((abs_path, rel_path, result)) }); diff --git a/src/producer.rs b/src/producer.rs index ca1fa7286..ad4a6a60e 100644 --- a/src/producer.rs +++ b/src/producer.rs @@ -108,11 +108,9 @@ impl Archive { linked_files_maps.borrow_mut().insert(filename, self); } } - "out" => { - if Archive::check_file(file, &Archive::is_go_cov) { - let filename = clean_path(path); - self.insert_vec(filename, gocovs); - } + "out" if Archive::check_file(file, &Archive::is_go_cov) => { + let filename = clean_path(path); + self.insert_vec(filename, gocovs); } _ => {} }