kbknapp/cargo-count

Incorrect number of "unsafe" instances reported

sunfishcode opened this issue · 0 comments

Cargo-count incorrectly reports that the following code has no instances of "unsafe":

fn test() {
    unsafe { match doit() { } }
}
Gathering information...
         Language  Files  Lines  Blanks  Comments  Code  Unsafe (%)
         --------  -----  -----  ------  --------  ----  ----------
         Rust      1      3      0       0         3     
         --------  -----  -----  ------  --------  ----  ----------
Totals:            1      3      0       0         3     0 (0.00%)

For comparison, it correctly reports that this testcase has an instance of "unsafe" in it:

fn test() {
    match unsafe { doit() } { }
}
Gathering information...
         Language  Files  Lines  Blanks  Comments  Code  Unsafe (%)
         --------  -----  -----  ------  --------  ----  ----------
         Rust      1      3      0       0         3     1 (33.33%)
         --------  -----  -----  ------  --------  ----  ----------
Totals:            1      3      0       0         3     1 (33.33%)