cargo-count
cargo-count copied to clipboard
Fixed the unsafe regex.
The previous regex missed many occurrences of unsafe, because it required something before and behind the keyword (see #38). Requiring a word boundary fixes that problem.
However, the counting of unsafe code is still fishy. For example, occurrences of "unsafe" in strings are counted as unsafe code. Also, the formatting matters. This counts as 3 unsafe lines:
unsafe {
func();
}
And this as 1 unsafe line:
unsafe
{
func();
}