diff options
Diffstat (limited to 'xtask/tests')
-rw-r--r-- | xtask/tests/tidy-tests/main.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/xtask/tests/tidy-tests/main.rs b/xtask/tests/tidy-tests/main.rs index 80911a68e..e5247854a 100644 --- a/xtask/tests/tidy-tests/main.rs +++ b/xtask/tests/tidy-tests/main.rs | |||
@@ -20,7 +20,16 @@ fn rust_files_are_tidy() { | |||
20 | } | 20 | } |
21 | 21 | ||
22 | fn check_todo(path: &Path, text: &str) { | 22 | fn check_todo(path: &Path, text: &str) { |
23 | if path.ends_with("tests/cli.rs") { | 23 | let whitelist = &[ |
24 | // This file itself is whitelisted since this test itself contains matches. | ||
25 | "tests/cli.rs", | ||
26 | // Some of our assists generate `todo!()` so those files are whitelisted. | ||
27 | "doc_tests/generated.rs", | ||
28 | "handlers/add_missing_impl_members.rs", | ||
29 | // To support generating `todo!()` in assists, we have `expr_todo()` in ast::make. | ||
30 | "ast/make.rs", | ||
31 | ]; | ||
32 | if whitelist.iter().any(|p| path.ends_with(p)) { | ||
24 | return; | 33 | return; |
25 | } | 34 | } |
26 | if text.contains("TODO") || text.contains("TOOD") || text.contains("todo!") { | 35 | if text.contains("TODO") || text.contains("TOOD") || text.contains("todo!") { |
@@ -37,9 +46,9 @@ fn check_trailing_ws(path: &Path, text: &str) { | |||
37 | if is_exclude_dir(path, &["test_data"]) { | 46 | if is_exclude_dir(path, &["test_data"]) { |
38 | return; | 47 | return; |
39 | } | 48 | } |
40 | for line in text.lines() { | 49 | for (line_number, line) in text.lines().enumerate() { |
41 | if line.chars().last().map(char::is_whitespace) == Some(true) { | 50 | if line.chars().last().map(char::is_whitespace) == Some(true) { |
42 | panic!("Trailing whitespace in {}", path.display()) | 51 | panic!("Trailing whitespace in {} at line {}", path.display(), line_number) |
43 | } | 52 | } |
44 | } | 53 | } |
45 | } | 54 | } |