Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

false positive when matching enum #258

Closed
tspiteri opened this issue Oct 1, 2019 · 2 comments
Closed

false positive when matching enum #258

tspiteri opened this issue Oct 1, 2019 · 2 comments

Comments

@tspiteri
Copy link

tspiteri commented Oct 1, 2019

For this code

enum E{
    A,
    B(i32),
}
pub fn foo(i: i32) -> i32 {
    let e = if i == 0 { E::A } else { E::B(i) };
    match e {
        E::A => 1,
        E::B(x) => x,
    }
}

#[cfg(test)]
mod tests {
    #[test]
    fn it_works() {
        use crate::foo;
        assert_eq!(foo(0), 1);
        assert_eq!(foo(2), 2);
    }
}

I get a false positive for an uncovered line 7 (match e).

$ cargo tarpaulin -V
cargo-tarpaulin version: 0.8.7
@grim7reaper
Copy link

grim7reaper commented Jan 26, 2020

I'm also affected by this.

In the following code:

impl fmt::Display for DateError {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match *self {
            Self::InvalidMonth => write!(f, "invalid month"),
            Self::InvalidDay => write!(f, "invalid day of the month"),
        }
    }
}

The match *self { is shown as not covered.

Anything we can do on our side to help you pinpoint/fix the issue? 🙂

@xd009642 xd009642 mentioned this issue Feb 23, 2020
15 tasks
@xd009642
Copy link
Owner

Closing in favour of the new mega-coverage issue #351

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants