mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 07:04:18 +00:00
249 lines
6.9 KiB
Text
249 lines
6.9 KiB
Text
error: trivial regex
|
|
--> tests/ui/regex.rs:19:45
|
|
|
|
|
LL | let pipe_in_wrong_position = Regex::new("|");
|
|
| ^^^
|
|
|
|
|
= help: the regex is unlikely to be useful as it is
|
|
= note: `-D clippy::trivial-regex` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::trivial_regex)]`
|
|
|
|
error: trivial regex
|
|
--> tests/ui/regex.rs:21:60
|
|
|
|
|
LL | let pipe_in_wrong_position_builder = RegexBuilder::new("|");
|
|
| ^^^
|
|
|
|
|
= help: the regex is unlikely to be useful as it is
|
|
|
|
error: regex syntax error: invalid character class range, the start must be <= the end
|
|
--> tests/ui/regex.rs:23:42
|
|
|
|
|
LL | let wrong_char_ranice = Regex::new("[z-a]");
|
|
| ^^^
|
|
|
|
|
= note: `-D clippy::invalid-regex` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::invalid_regex)]`
|
|
|
|
error: regex syntax error: invalid character class range, the start must be <= the end
|
|
--> tests/ui/regex.rs:26:37
|
|
|
|
|
LL | let some_unicode = Regex::new("[é-è]");
|
|
| ^^^
|
|
|
|
error: regex parse error:
|
|
(
|
|
^
|
|
error: unclosed group
|
|
--> tests/ui/regex.rs:29:33
|
|
|
|
|
LL | let some_regex = Regex::new(OPENING_PAREN);
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error: trivial regex
|
|
--> tests/ui/regex.rs:31:53
|
|
|
|
|
LL | let binary_pipe_in_wrong_position = BRegex::new("|");
|
|
| ^^^
|
|
|
|
|
= help: the regex is unlikely to be useful as it is
|
|
|
|
error: regex parse error:
|
|
(
|
|
^
|
|
error: unclosed group
|
|
--> tests/ui/regex.rs:33:41
|
|
|
|
|
LL | let some_binary_regex = BRegex::new(OPENING_PAREN);
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error: regex parse error:
|
|
(
|
|
^
|
|
error: unclosed group
|
|
--> tests/ui/regex.rs:34:56
|
|
|
|
|
LL | let some_binary_regex_builder = BRegexBuilder::new(OPENING_PAREN);
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error: regex parse error:
|
|
(
|
|
^
|
|
error: unclosed group
|
|
--> tests/ui/regex.rs:46:37
|
|
|
|
|
LL | let set_error = RegexSet::new(&[OPENING_PAREN, r"[a-z]+\.(com|org|net)"]);
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error: regex parse error:
|
|
(
|
|
^
|
|
error: unclosed group
|
|
--> tests/ui/regex.rs:47:39
|
|
|
|
|
LL | let bset_error = BRegexSet::new(&[OPENING_PAREN, r"[a-z]+\.(com|org|net)"]);
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error: regex parse error:
|
|
\b\c
|
|
^^
|
|
error: unrecognized escape sequence
|
|
--> tests/ui/regex.rs:54:42
|
|
|
|
|
LL | let escaped_string_span = Regex::new("\\b\\c");
|
|
| ^^^^^^^^
|
|
|
|
|
= help: consider using a raw string literal: `r".."`
|
|
|
|
error: regex syntax error: duplicate flag
|
|
--> tests/ui/regex.rs:56:34
|
|
|
|
|
LL | let aux_span = Regex::new("(?ixi)");
|
|
| ^ ^
|
|
|
|
error: regex syntax error: pattern can match invalid UTF-8
|
|
--> tests/ui/regex.rs:62:53
|
|
|
|
|
LL | let invalid_utf8_should_lint = Regex::new("(?-u).");
|
|
| ^
|
|
|
|
error: trivial regex
|
|
--> tests/ui/regex.rs:67:33
|
|
|
|
|
LL | let trivial_eq = Regex::new("^foobar$");
|
|
| ^^^^^^^^^^
|
|
|
|
|
= help: consider using `==` on `str`s
|
|
|
|
error: trivial regex
|
|
--> tests/ui/regex.rs:70:48
|
|
|
|
|
LL | let trivial_eq_builder = RegexBuilder::new("^foobar$");
|
|
| ^^^^^^^^^^
|
|
|
|
|
= help: consider using `==` on `str`s
|
|
|
|
error: trivial regex
|
|
--> tests/ui/regex.rs:73:42
|
|
|
|
|
LL | let trivial_starts_with = Regex::new("^foobar");
|
|
| ^^^^^^^^^
|
|
|
|
|
= help: consider using `str::starts_with`
|
|
|
|
error: trivial regex
|
|
--> tests/ui/regex.rs:76:40
|
|
|
|
|
LL | let trivial_ends_with = Regex::new("foobar$");
|
|
| ^^^^^^^^^
|
|
|
|
|
= help: consider using `str::ends_with`
|
|
|
|
error: trivial regex
|
|
--> tests/ui/regex.rs:79:39
|
|
|
|
|
LL | let trivial_contains = Regex::new("foobar");
|
|
| ^^^^^^^^
|
|
|
|
|
= help: consider using `str::contains`
|
|
|
|
error: trivial regex
|
|
--> tests/ui/regex.rs:82:39
|
|
|
|
|
LL | let trivial_contains = Regex::new(NOT_A_REAL_REGEX);
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: consider using `str::contains`
|
|
|
|
error: trivial regex
|
|
--> tests/ui/regex.rs:85:40
|
|
|
|
|
LL | let trivial_backslash = Regex::new("a\\.b");
|
|
| ^^^^^^^
|
|
|
|
|
= help: consider using `str::contains`
|
|
|
|
error: trivial regex
|
|
--> tests/ui/regex.rs:89:36
|
|
|
|
|
LL | let trivial_empty = Regex::new("");
|
|
| ^^
|
|
|
|
|
= help: the regex is unlikely to be useful as it is
|
|
|
|
error: trivial regex
|
|
--> tests/ui/regex.rs:92:36
|
|
|
|
|
LL | let trivial_empty = Regex::new("^");
|
|
| ^^^
|
|
|
|
|
= help: the regex is unlikely to be useful as it is
|
|
|
|
error: trivial regex
|
|
--> tests/ui/regex.rs:95:36
|
|
|
|
|
LL | let trivial_empty = Regex::new("^$");
|
|
| ^^^^
|
|
|
|
|
= help: consider using `str::is_empty`
|
|
|
|
error: trivial regex
|
|
--> tests/ui/regex.rs:98:44
|
|
|
|
|
LL | let binary_trivial_empty = BRegex::new("^$");
|
|
| ^^^^
|
|
|
|
|
= help: consider using `str::is_empty`
|
|
|
|
error: compiling a regex in a loop
|
|
--> tests/ui/regex.rs:125:21
|
|
|
|
|
LL | let regex = Regex::new("a.b");
|
|
| ^^^^^^^^^^
|
|
|
|
|
help: move the regex construction outside this loop
|
|
--> tests/ui/regex.rs:122:5
|
|
|
|
|
LL | loop {
|
|
| ^^^^
|
|
= note: `-D clippy::regex-creation-in-loops` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::regex_creation_in_loops)]`
|
|
|
|
error: compiling a regex in a loop
|
|
--> tests/ui/regex.rs:127:21
|
|
|
|
|
LL | let regex = BRegex::new("a.b");
|
|
| ^^^^^^^^^^^
|
|
|
|
|
help: move the regex construction outside this loop
|
|
--> tests/ui/regex.rs:122:5
|
|
|
|
|
LL | loop {
|
|
| ^^^^
|
|
|
|
error: compiling a regex in a loop
|
|
--> tests/ui/regex.rs:133:25
|
|
|
|
|
LL | let regex = Regex::new("a.b");
|
|
| ^^^^^^^^^^
|
|
|
|
|
help: move the regex construction outside this loop
|
|
--> tests/ui/regex.rs:122:5
|
|
|
|
|
LL | loop {
|
|
| ^^^^
|
|
|
|
error: compiling a regex in a loop
|
|
--> tests/ui/regex.rs:138:32
|
|
|
|
|
LL | let nested_regex = Regex::new("a.b");
|
|
| ^^^^^^^^^^
|
|
|
|
|
help: move the regex construction outside this loop
|
|
--> tests/ui/regex.rs:137:9
|
|
|
|
|
LL | for _ in 0..10 {
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
error: aborting due to 28 previous errors
|
|
|