Skip to content
This repository was archived by the owner on Nov 14, 2023. It is now read-only.
This repository was archived by the owner on Nov 14, 2023. It is now read-only.

Incorrect number of "unsafe" instances reported #38

@sunfishcode

Description

@sunfishcode

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%)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions