I created simple test to try cargo coverage:
pub fn f(i: i32) -> i32 { i + 1 }
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
As you see f
do was not referenced and so was not called.
But cargo coverage
reports 100% coverage.
I found this topic and
related merged PR,
also I grep cargo coverage and it’s code contains std::env::set_var("RUSTFLAGS", "-C link-dead-code");
,
so is -C link-dead-code
becomes broken?