Skip to content

Commit

Permalink
Fix unicode regexen with bytes::Regex
Browse files Browse the repository at this point in the history
fixes #6005
  • Loading branch information
llogiq committed Oct 7, 2020
1 parent 2771918 commit 1167257
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion clippy_lints/src/regex.rs
Expand Up @@ -143,7 +143,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(utf8)
.unicode(true)
.allow_invalid_utf8(!utf8)
.build();

Expand Down
3 changes: 3 additions & 0 deletions tests/ui/regex.rs
Expand Up @@ -71,6 +71,9 @@ fn trivial_regex() {
let non_trivial_ends_with = Regex::new("foo|bar");
let non_trivial_binary = BRegex::new("foo|bar");
let non_trivial_binary_builder = BRegexBuilder::new("foo|bar");

// #6005: unicode classes in bytes::Regex
let a_byte_of_unicode = BRegex::new(r"\p{C}");
}

fn main() {
Expand Down

0 comments on commit 1167257

Please sign in to comment.