From ae5b87f1e126bf410f673cbcb040bf2c2a52a497 Mon Sep 17 00:00:00 2001 From: fangsong-cellink Date: Fri, 3 Jul 2026 11:20:58 +0200 Subject: [PATCH 1/2] Prevent raising error for gcov format v2 --- src/parser.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From f2d740a2db1b6ff16ff089d6252f03e3c8d6f713 Mon Sep 17 00:00:00 2001 From: fangsong-cellink Date: Fri, 3 Jul 2026 11:47:10 +0200 Subject: [PATCH 2/2] Fix linting errors --- src/cobertura.rs | 4 ++-- src/path_rewriting.rs | 16 ++++------------ src/producer.rs | 8 +++----- 3 files changed, 9 insertions(+), 19 deletions(-) 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/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); } _ => {} }