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

Regex 1.8.0: Valid ?P<foo> -> ?<foo> triggers lint #10680

Closed
torsteingrindvik opened this issue Apr 21, 2023 · 1 comment · Fixed by #10682
Closed

Regex 1.8.0: Valid ?P<foo> -> ?<foo> triggers lint #10680

torsteingrindvik opened this issue Apr 21, 2023 · 1 comment · Fixed by #10682
Assignees
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have

Comments

@torsteingrindvik
Copy link

torsteingrindvik commented Apr 21, 2023

Summary

https://github.com/rust-lang/regex/blob/master/CHANGELOG.md
rust-lang/regex#955

A new feature was added to regex 1.8.0 which allows removing this P character.
The feature works, but clippy emits a false positive to it.

Lint Name

clippy::invalid_regex

Reproducer

use regex::Regex;

fn main() {
    let _re1 = Regex::new(r"(?P<hi>hi)").unwrap();

    // regex 1.8.0: Can now remove the P character
    let _re2 = Regex::new(r"(?<hi>hi)").unwrap();
    // ^-- clippy::invalid_regex
}

I saw this happen: Clippy complains.
I expected to see this happen: No complaints.

Version

rustc 1.71.0-nightly (8bdcc62cb 2023-04-20)
binary: rustc
commit-hash: 8bdcc62cb0362869f0e7b43a6ae4f96b953d3cbc
commit-date: 2023-04-20
host: x86_64-unknown-linux-gnu
release: 1.71.0-nightly
LLVM version: 16.0.2

Additional Labels

No response

@torsteingrindvik torsteingrindvik added C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have labels Apr 21, 2023
@J-ZhengLi
Copy link
Member

@rustbot claim

bors added a commit that referenced this issue May 11, 2023
fix [`invalid_regex`] not recognizing new syntax introduced after regex-1.8.0

fixes: #10680

---

changelog:
- bump up `regex-syntax` dependency version to 0.7.0
- fix [`invalid_regex`] not recognizing new syntax introduced after regex-1.8.0
bors added a commit that referenced this issue May 11, 2023
fix [`invalid_regex`] not recognizing new syntax introduced after regex-1.8.0

fixes: #10680

---

changelog:
- bump up `regex-syntax` dependency version to 0.7.0
- fix [`invalid_regex`] not recognizing new syntax introduced after regex-1.8.0
@bors bors closed this as completed in 223f518 May 18, 2023
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-positive Issue: The lint was triggered on code it shouldn't have
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants