clean tests/ui/regex.rs

Cleaning the empty lines for clarity.
This commit is contained in:
Luis de Bethencourt 2017-05-11 15:41:40 +01:00
parent 36ba4885ab
commit bf6d4b7129
2 changed files with 44 additions and 76 deletions

View File

@ -14,24 +14,16 @@ const NOT_A_REAL_REGEX : &'static str = "foobar";
fn syntax_error() {
let pipe_in_wrong_position = Regex::new("|");
let pipe_in_wrong_position_builder = RegexBuilder::new("|");
let wrong_char_ranice = Regex::new("[z-a]");
let some_unicode = Regex::new("[é-è]");
let some_regex = Regex::new(OPENING_PAREN);
let binary_pipe_in_wrong_position = BRegex::new("|");
let some_binary_regex = BRegex::new(OPENING_PAREN);
let some_binary_regex_builder = BRegexBuilder::new(OPENING_PAREN);
let closing_paren = ")";
let not_linted = Regex::new(closing_paren);
@ -46,12 +38,10 @@ fn syntax_error() {
let set_error = RegexSet::new(&[
OPENING_PAREN,
r"[a-z]+\.(com|org|net)",
]);
let bset_error = BRegexSet::new(&[
OPENING_PAREN,
r"[a-z]+\.(com|org|net)",
]);
}
@ -59,49 +49,27 @@ fn syntax_error() {
fn trivial_regex() {
let trivial_eq = Regex::new("^foobar$");
let trivial_eq_builder = RegexBuilder::new("^foobar$");
let trivial_starts_with = Regex::new("^foobar");
let trivial_ends_with = Regex::new("foobar$");
let trivial_contains = Regex::new("foobar");
let trivial_contains = Regex::new(NOT_A_REAL_REGEX);
let trivial_backslash = Regex::new("a\\.b");
// unlikely corner cases
let trivial_empty = Regex::new("");
let trivial_empty = Regex::new("^");
let trivial_empty = Regex::new("^$");
let binary_trivial_empty = BRegex::new("^$");
// non-trivial regexes
let non_trivial_dot = Regex::new("a.b");
let non_trivial_dot_builder = RegexBuilder::new("a.b");

View File

@ -7,81 +7,81 @@ error: regex syntax error: empty alternate
= note: #[deny(invalid_regex)] on by default
error: regex syntax error: empty alternate
--> $DIR/regex.rs:18:60
--> $DIR/regex.rs:17:60
|
18 | let pipe_in_wrong_position_builder = RegexBuilder::new("|");
17 | let pipe_in_wrong_position_builder = RegexBuilder::new("|");
| ^^^
|
= note: #[deny(invalid_regex)] on by default
error: regex syntax error: invalid character class range
--> $DIR/regex.rs:20:40
--> $DIR/regex.rs:18:40
|
20 | let wrong_char_ranice = Regex::new("[z-a]");
18 | let wrong_char_ranice = Regex::new("[z-a]");
| ^^^^^^^
|
= note: #[deny(invalid_regex)] on by default
error: regex syntax error: invalid character class range
--> $DIR/regex.rs:22:35
--> $DIR/regex.rs:19:35
|
22 | let some_unicode = Regex::new("[é-è]");
19 | let some_unicode = Regex::new("[é-è]");
| ^^^^^^^
|
= note: #[deny(invalid_regex)] on by default
error: regex syntax error on position 0: unclosed parenthesis
--> $DIR/regex.rs:25:33
--> $DIR/regex.rs:21:33
|
25 | let some_regex = Regex::new(OPENING_PAREN);
21 | let some_regex = Regex::new(OPENING_PAREN);
| ^^^^^^^^^^^^^
|
= note: #[deny(invalid_regex)] on by default
error: regex syntax error: empty alternate
--> $DIR/regex.rs:28:53
--> $DIR/regex.rs:23:53
|
28 | let binary_pipe_in_wrong_position = BRegex::new("|");
23 | let binary_pipe_in_wrong_position = BRegex::new("|");
| ^^^
|
= note: #[deny(invalid_regex)] on by default
error: regex syntax error on position 0: unclosed parenthesis
--> $DIR/regex.rs:30:41
--> $DIR/regex.rs:24:41
|
30 | let some_binary_regex = BRegex::new(OPENING_PAREN);
24 | let some_binary_regex = BRegex::new(OPENING_PAREN);
| ^^^^^^^^^^^^^
|
= note: #[deny(invalid_regex)] on by default
error: regex syntax error on position 0: unclosed parenthesis
--> $DIR/regex.rs:32:56
--> $DIR/regex.rs:25:56
|
32 | let some_binary_regex_builder = BRegexBuilder::new(OPENING_PAREN);
25 | let some_binary_regex_builder = BRegexBuilder::new(OPENING_PAREN);
| ^^^^^^^^^^^^^
|
= note: #[deny(invalid_regex)] on by default
error: regex syntax error on position 0: unclosed parenthesis
--> $DIR/regex.rs:48:9
--> $DIR/regex.rs:40:9
|
48 | OPENING_PAREN,
40 | OPENING_PAREN,
| ^^^^^^^^^^^^^
|
= note: #[deny(invalid_regex)] on by default
error: regex syntax error on position 0: unclosed parenthesis
--> $DIR/regex.rs:53:9
--> $DIR/regex.rs:44:9
|
53 | OPENING_PAREN,
44 | OPENING_PAREN,
| ^^^^^^^^^^^^^
|
= note: #[deny(invalid_regex)] on by default
error: trivial regex
--> $DIR/regex.rs:60:33
--> $DIR/regex.rs:50:33
|
60 | let trivial_eq = Regex::new("^foobar$");
50 | let trivial_eq = Regex::new("^foobar$");
| ^^^^^^^^^^
|
note: lint level defined here
@ -92,84 +92,84 @@ note: lint level defined here
= help: consider using consider using `==` on `str`s
error: trivial regex
--> $DIR/regex.rs:64:48
--> $DIR/regex.rs:52:48
|
64 | let trivial_eq_builder = RegexBuilder::new("^foobar$");
52 | let trivial_eq_builder = RegexBuilder::new("^foobar$");
| ^^^^^^^^^^
|
= help: consider using consider using `==` on `str`s
error: trivial regex
--> $DIR/regex.rs:68:42
--> $DIR/regex.rs:54:42
|
68 | let trivial_starts_with = Regex::new("^foobar");
54 | let trivial_starts_with = Regex::new("^foobar");
| ^^^^^^^^^
|
= help: consider using consider using `str::starts_with`
error: trivial regex
--> $DIR/regex.rs:72:40
--> $DIR/regex.rs:56:40
|
72 | let trivial_ends_with = Regex::new("foobar$");
56 | let trivial_ends_with = Regex::new("foobar$");
| ^^^^^^^^^
|
= help: consider using consider using `str::ends_with`
error: trivial regex
--> $DIR/regex.rs:76:39
--> $DIR/regex.rs:58:39
|
76 | let trivial_contains = Regex::new("foobar");
58 | let trivial_contains = Regex::new("foobar");
| ^^^^^^^^
|
= help: consider using consider using `str::contains`
error: trivial regex
--> $DIR/regex.rs:80:39
--> $DIR/regex.rs:60:39
|
80 | let trivial_contains = Regex::new(NOT_A_REAL_REGEX);
60 | let trivial_contains = Regex::new(NOT_A_REAL_REGEX);
| ^^^^^^^^^^^^^^^^
|
= help: consider using consider using `str::contains`
error: trivial regex
--> $DIR/regex.rs:84:40
--> $DIR/regex.rs:62:40
|
84 | let trivial_backslash = Regex::new("a//.b");
62 | let trivial_backslash = Regex::new("a//.b");
| ^^^^^^^
|
= help: consider using consider using `str::contains`
error: trivial regex
--> $DIR/regex.rs:89:36
--> $DIR/regex.rs:65:36
|
89 | let trivial_empty = Regex::new("");
65 | let trivial_empty = Regex::new("");
| ^^
|
= help: consider using the regex is unlikely to be useful as it is
error: trivial regex
--> $DIR/regex.rs:93:36
--> $DIR/regex.rs:67:36
|
93 | let trivial_empty = Regex::new("^");
67 | let trivial_empty = Regex::new("^");
| ^^^
|
= help: consider using the regex is unlikely to be useful as it is
error: trivial regex
--> $DIR/regex.rs:97:36
--> $DIR/regex.rs:69:36
|
97 | let trivial_empty = Regex::new("^$");
69 | let trivial_empty = Regex::new("^$");
| ^^^^
|
= help: consider using consider using `str::is_empty`
error: trivial regex
--> $DIR/regex.rs:101:44
|
101 | let binary_trivial_empty = BRegex::new("^$");
| ^^^^
|
= help: consider using consider using `str::is_empty`
--> $DIR/regex.rs:71:44
|
71 | let binary_trivial_empty = BRegex::new("^$");
| ^^^^
|
= help: consider using consider using `str::is_empty`
error: aborting due to 21 previous errors