cargo-count icon indicating copy to clipboard operation
cargo-count copied to clipboard

Fixed the unsafe regex.

Open Nils-TUD opened this issue 7 years ago • 0 comments

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();
}

Nils-TUD avatar Dec 18 '17 20:12 Nils-TUD