aboutsummaryrefslogtreecommitdiff
path: root/xtask/tests/tidy.rs
diff options
context:
space:
mode:
authorMikhail Rakhmanov <[email protected]>2020-06-03 18:26:01 +0100
committerMikhail Rakhmanov <[email protected]>2020-06-03 18:26:01 +0100
commit6a0083a519680e8d16bde5d7c1940c8dd6d4e9d4 (patch)
tree2b377141d722257cfea18e74b955aea1a8f6cc1a /xtask/tests/tidy.rs
parent1f7de306f547ecb394a34445fd6ac1d6bc8ab439 (diff)
parent794f6da821c5d6e2490b996baffe162e4753262d (diff)
Merge branch 'master' into compute-lazy-assits
# Conflicts: # crates/rust-analyzer/src/main_loop/handlers.rs # crates/rust-analyzer/src/to_proto.rs
Diffstat (limited to 'xtask/tests/tidy.rs')
-rw-r--r--xtask/tests/tidy.rs25
1 files changed, 8 insertions, 17 deletions
diff --git a/xtask/tests/tidy.rs b/xtask/tests/tidy.rs
index 4ac5d929f..d38ac7f17 100644
--- a/xtask/tests/tidy.rs
+++ b/xtask/tests/tidy.rs
@@ -25,19 +25,12 @@ fn generated_tests_are_fresh() {
25 25
26#[test] 26#[test]
27fn generated_assists_are_fresh() { 27fn generated_assists_are_fresh() {
28 if let Err(error) = codegen::generate_assists_docs(Mode::Verify) { 28 if let Err(error) = codegen::generate_assists_tests(Mode::Verify) {
29 panic!("{}. Please update assists by running `cargo xtask codegen`", error); 29 panic!("{}. Please update assists by running `cargo xtask codegen`", error);
30 } 30 }
31} 31}
32 32
33#[test] 33#[test]
34fn generated_features_are_fresh() {
35 if let Err(error) = codegen::generate_feature_docs(Mode::Verify) {
36 panic!("{}. Please update features by running `cargo xtask codegen`", error);
37 }
38}
39
40#[test]
41fn check_code_formatting() { 34fn check_code_formatting() {
42 if let Err(error) = run_rustfmt(Mode::Verify) { 35 if let Err(error) = run_rustfmt(Mode::Verify) {
43 panic!("{}. Please format the code by running `cargo format`", error); 36 panic!("{}. Please format the code by running `cargo format`", error);
@@ -180,13 +173,11 @@ impl TidyDocs {
180} 173}
181 174
182fn is_exclude_dir(p: &Path, dirs_to_exclude: &[&str]) -> bool { 175fn is_exclude_dir(p: &Path, dirs_to_exclude: &[&str]) -> bool {
183 let mut cur_path = p; 176 p.strip_prefix(project_root())
184 while let Some(path) = cur_path.parent() { 177 .unwrap()
185 if dirs_to_exclude.iter().any(|dir| path.ends_with(dir)) { 178 .components()
186 return true; 179 .rev()
187 } 180 .skip(1)
188 cur_path = path; 181 .filter_map(|it| it.as_os_str().to_str())
189 } 182 .any(|it| dirs_to_exclude.contains(&it))
190
191 false
192} 183}