blob: aaec3bc142003389ae61a3e36348a5bfddb2a845 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
|
error: trivial regex
--> tests/ui/regex.rs:20: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:22: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:24: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:27:37
|
LL | let some_unicode = Regex::new("[é-è]");
| ^^^
error: regex parse error:
(
^
error: unclosed group
--> tests/ui/regex.rs:30:33
|
LL | let some_regex = Regex::new(OPENING_PAREN);
| ^^^^^^^^^^^^^
error: trivial regex
--> tests/ui/regex.rs:33: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:35:41
|
LL | let some_binary_regex = BRegex::new(OPENING_PAREN);
| ^^^^^^^^^^^^^
error: regex parse error:
(
^
error: unclosed group
--> tests/ui/regex.rs:37:56
|
LL | let some_binary_regex_builder = BRegexBuilder::new(OPENING_PAREN);
| ^^^^^^^^^^^^^
error: regex parse error:
(
^
error: unclosed group
--> tests/ui/regex.rs:50: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:52: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:60: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:63:34
|
LL | let aux_span = Regex::new("(?ixi)");
| ^ ^
error: regex syntax error: pattern can match invalid UTF-8
--> tests/ui/regex.rs:69:53
|
LL | let invalid_utf8_should_lint = Regex::new("(?-u).");
| ^
error: trivial regex
--> tests/ui/regex.rs:74:33
|
LL | let trivial_eq = Regex::new("^foobar$");
| ^^^^^^^^^^
|
= help: consider using `==` on `str`s
error: trivial regex
--> tests/ui/regex.rs:77:48
|
LL | let trivial_eq_builder = RegexBuilder::new("^foobar$");
| ^^^^^^^^^^
|
= help: consider using `==` on `str`s
error: trivial regex
--> tests/ui/regex.rs:80:42
|
LL | let trivial_starts_with = Regex::new("^foobar");
| ^^^^^^^^^
|
= help: consider using `str::starts_with`
error: trivial regex
--> tests/ui/regex.rs:83:40
|
LL | let trivial_ends_with = Regex::new("foobar$");
| ^^^^^^^^^
|
= help: consider using `str::ends_with`
error: trivial regex
--> tests/ui/regex.rs:86:39
|
LL | let trivial_contains = Regex::new("foobar");
| ^^^^^^^^
|
= help: consider using `str::contains`
error: trivial regex
--> tests/ui/regex.rs:89:39
|
LL | let trivial_contains = Regex::new(NOT_A_REAL_REGEX);
| ^^^^^^^^^^^^^^^^
|
= help: consider using `str::contains`
error: trivial regex
--> tests/ui/regex.rs:92:40
|
LL | let trivial_backslash = Regex::new("a\\.b");
| ^^^^^^^
|
= help: consider using `str::contains`
error: trivial regex
--> tests/ui/regex.rs:96: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:99: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:102:36
|
LL | let trivial_empty = Regex::new("^$");
| ^^^^
|
= help: consider using `str::is_empty`
error: trivial regex
--> tests/ui/regex.rs:105: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:132:21
|
LL | let regex = Regex::new("a.b");
| ^^^^^^^^^^
|
help: move the regex construction outside this loop
--> tests/ui/regex.rs:129: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:134:21
|
LL | let regex = BRegex::new("a.b");
| ^^^^^^^^^^^
|
help: move the regex construction outside this loop
--> tests/ui/regex.rs:129:5
|
LL | loop {
| ^^^^
error: compiling a regex in a loop
--> tests/ui/regex.rs:140:25
|
LL | let regex = Regex::new("a.b");
| ^^^^^^^^^^
|
help: move the regex construction outside this loop
--> tests/ui/regex.rs:129:5
|
LL | loop {
| ^^^^
error: compiling a regex in a loop
--> tests/ui/regex.rs:145:32
|
LL | let nested_regex = Regex::new("a.b");
| ^^^^^^^^^^
|
help: move the regex construction outside this loop
--> tests/ui/regex.rs:144:9
|
LL | for _ in 0..10 {
| ^^^^^^^^^^^^^^
error: aborting due to 28 previous errors
|