profile
viewpoint

Ask questionsUnrecognized escape sequence

Clippy version: clippy 0.0.212 (265318d 2019-05-17)

I get the following error when linting code, and I have a feeling it might be a bug. If it is not, it maybe clippy can give a correct suggestion?

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
rust-lang/rust-clippy

Answer questions ThomasdenH

I found the solution here. The reason it fails is because it should be escaped once for the string literal, and once for the regex. If possible, a better description of the problem would be nice.

useful!
source:https://uonfu.com/
Github User Rank List