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

Clippy does not check fancy_regex (or friends) #10205

Open
schneems opened this issue Jan 16, 2023 · 1 comment
Open

Clippy does not check fancy_regex (or friends) #10205

schneems opened this issue Jan 16, 2023 · 1 comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't

Comments

@schneems
Copy link

Summary

Hello and thank you for this amazing project!

I see that this Regex lint https://rust-lang.github.io/rust-clippy/master/index.html#invalid_regex will only check a Regex from the regex crate. I would like the ability to lint Regex creation in other crates, specifically fancy_regex.

I'm reporting this as a bug since after rust-lang/regex#607 I believed that I was able to use unwrap/expect unchecked with regex creation since I've got clippy configured to check my project. Later I realized I need multiple different regex crates. I think if someone comes across that issue and sees that Regex::new() is checked, they might not realize or remember they're using an unsupported crate.

Lint Name

invalid_regex

Reproducer

I tried this code:

let _foo = fancy_regex::Regex::new("(").unwrap();

I expected to see this happen:

error: regex syntax error: unclosed group
   --> commons/src/gem_version.rs:198:39
    |
198 |         let _foo = fancy_regex::Regex::new("(").unwrap();

Instead, this happened:

$ cargo clippy --all-targets
    Blocking waiting for file lock on build directory
    Checking commons v0.1.0 (/Users/rschneeman/Documents/projects/work/buildpacks/buildpacks-ruby/commons)
    Finished dev [unoptimized + debuginfo] target(s) in 0.93s

Version

$ rustc -Vv
rustc 1.66.1 (90743e729 2023-01-10)
binary: rustc
commit-hash: 90743e7298aca107ddaa0c202a4d3604e29bfeb6
commit-date: 2023-01-10
host: x86_64-apple-darwin
release: 1.66.1
LLVM version: 15.0.2
@schneems schneems added C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't labels Jan 16, 2023
@schneems
Copy link
Author

There are also other regex crates such as https://crates.io/crates/regex-lite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't
Projects
None yet
Development

No branches or pull requests

1 participant