Fixing invalid_regex with invalid UTF8. Also, adding more test cases

This commit is contained in:
Renato Lochetti 2023-05-28 12:53:03 +01:00
parent dc17e7317b
commit ffc2bc83b0
No known key found for this signature in database
GPG key ID: 4B78B34B3DE7EBCC
3 changed files with 26 additions and 13 deletions

View file

@ -177,7 +177,7 @@ fn check_set<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, utf8: bool) {
}
fn check_regex<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, utf8: bool) {
let mut parser = regex_syntax::ParserBuilder::new().unicode(true).utf8(!utf8).build();
let mut parser = regex_syntax::ParserBuilder::new().unicode(true).utf8(utf8).build();
if let ExprKind::Lit(lit) = expr.kind {
if let LitKind::Str(ref r, style) = lit.node {