1
Fork 0

allow invalid UTF-8 in bytes Regexes

This commit is contained in:
Tim Neumann 2018-04-07 22:18:51 +02:00
parent 22df45f1ac
commit fad826f966
3 changed files with 35 additions and 31 deletions

View file

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