Open 623637646 opened 3 weeks ago
Another case which should be 100% coverage:
pub struct Disposal<F>
where
F: FnOnce(),
{
action: Option<F>,
}
impl<F> Drop for Disposal<F>
where
F: FnOnce(),
{
fn drop(&mut self) {
if let Some(action) = self.action.take() {
action();
}
}
}
#[cfg(test)]
mod tests {
#[test]
fn test_drop() {
let disposal = super::Disposal {
action: Some(|| {
println!("Dropping");
}),
};
drop(disposal);
}
}
You can also try adding in --engine llvm
to your tarpaulin call and seeing if that improves things :eyes:
@xd009642 I tried cargo tarpaulin --out Html --engine llvm
. The issue is still there.
Describe the bug
Wrong code coverage when using Generics.
Using commend:
cargo tarpaulin --out html
Platform: Mac 14.5
To Reproduce
Demo code:
The report is "66.67% coverage, 2/3 lines covered".
Expected behavior
The report should be "100% coverage, 3/3 lines covered".