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

"Unrecognized escape sequence" in Clippy #584

Closed
ThomasdenH opened this issue Jun 3, 2019 · 2 comments
Closed

"Unrecognized escape sequence" in Clippy #584

ThomasdenH opened this issue Jun 3, 2019 · 2 comments

Comments

@ThomasdenH
Copy link

I opened rust-lang/rust-clippy#4170 and was to open an issue here. The escaped backslash is not recognized:

error: regex syntax error: unrecognized escape sequence
   --> src/compiler/utilities.rs:187:52
    |
187 |         static ref RE: Regex = Regex::new("^..?($|[\\/])").unwrap();
    |                                                    ^^
    |
    = note: #[deny(clippy::invalid_regex)] on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#invalid_regex
@ThomasdenH
Copy link
Author

ThomasdenH commented Jun 3, 2019

Apparently it needs to be escaped twice, which makes sense. I kept the issue open there for a better warning.

@BurntSushi
Copy link
Member

Glad you figured it out. Note that the first example in the docs specifically mentions this issue. In particular, you might consider using raw strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants