diff options
-rw-r--r-- | xtask/src/codegen/gen_assists_docs.rs | 4 | ||||
-rw-r--r-- | xtask/src/codegen/gen_diagnostic_docs.rs | 2 | ||||
-rw-r--r-- | xtask/src/codegen/gen_feature_docs.rs | 2 | ||||
-rw-r--r-- | xtask/src/lib.rs | 6 | ||||
-rw-r--r-- | xtask/tests/tidy.rs | 2 |
5 files changed, 10 insertions, 6 deletions
diff --git a/xtask/src/codegen/gen_assists_docs.rs b/xtask/src/codegen/gen_assists_docs.rs index 6e18a50a6..51f58180c 100644 --- a/xtask/src/codegen/gen_assists_docs.rs +++ b/xtask/src/codegen/gen_assists_docs.rs | |||
@@ -4,7 +4,7 @@ use std::{fmt, path::Path}; | |||
4 | 4 | ||
5 | use crate::{ | 5 | use crate::{ |
6 | codegen::{self, extract_comment_blocks_with_empty_lines, reformat, Location, Mode, PREAMBLE}, | 6 | codegen::{self, extract_comment_blocks_with_empty_lines, reformat, Location, Mode, PREAMBLE}, |
7 | project_root, rust_files, Result, | 7 | project_root, rust_files_in, Result, |
8 | }; | 8 | }; |
9 | 9 | ||
10 | pub fn generate_assists_tests(mode: Mode) -> Result<()> { | 10 | pub fn generate_assists_tests(mode: Mode) -> Result<()> { |
@@ -32,7 +32,7 @@ struct Assist { | |||
32 | impl Assist { | 32 | impl Assist { |
33 | fn collect() -> Result<Vec<Assist>> { | 33 | fn collect() -> Result<Vec<Assist>> { |
34 | let mut res = Vec::new(); | 34 | let mut res = Vec::new(); |
35 | for path in rust_files(&project_root().join("crates/assists/src/handlers")) { | 35 | for path in rust_files_in(&project_root().join("crates/assists/src/handlers")) { |
36 | collect_file(&mut res, path.as_path())?; | 36 | collect_file(&mut res, path.as_path())?; |
37 | } | 37 | } |
38 | res.sort_by(|lhs, rhs| lhs.id.cmp(&rhs.id)); | 38 | res.sort_by(|lhs, rhs| lhs.id.cmp(&rhs.id)); |
diff --git a/xtask/src/codegen/gen_diagnostic_docs.rs b/xtask/src/codegen/gen_diagnostic_docs.rs index 00aaea5b7..7c14d4a07 100644 --- a/xtask/src/codegen/gen_diagnostic_docs.rs +++ b/xtask/src/codegen/gen_diagnostic_docs.rs | |||
@@ -27,7 +27,7 @@ struct Diagnostic { | |||
27 | impl Diagnostic { | 27 | impl Diagnostic { |
28 | fn collect() -> Result<Vec<Diagnostic>> { | 28 | fn collect() -> Result<Vec<Diagnostic>> { |
29 | let mut res = Vec::new(); | 29 | let mut res = Vec::new(); |
30 | for path in rust_files(&project_root()) { | 30 | for path in rust_files() { |
31 | collect_file(&mut res, path)?; | 31 | collect_file(&mut res, path)?; |
32 | } | 32 | } |
33 | res.sort_by(|lhs, rhs| lhs.id.cmp(&rhs.id)); | 33 | res.sort_by(|lhs, rhs| lhs.id.cmp(&rhs.id)); |
diff --git a/xtask/src/codegen/gen_feature_docs.rs b/xtask/src/codegen/gen_feature_docs.rs index 065dd33f1..61081063b 100644 --- a/xtask/src/codegen/gen_feature_docs.rs +++ b/xtask/src/codegen/gen_feature_docs.rs | |||
@@ -26,7 +26,7 @@ struct Feature { | |||
26 | impl Feature { | 26 | impl Feature { |
27 | fn collect() -> Result<Vec<Feature>> { | 27 | fn collect() -> Result<Vec<Feature>> { |
28 | let mut res = Vec::new(); | 28 | let mut res = Vec::new(); |
29 | for path in rust_files(&project_root()) { | 29 | for path in rust_files() { |
30 | collect_file(&mut res, path)?; | 30 | collect_file(&mut res, path)?; |
31 | } | 31 | } |
32 | res.sort_by(|lhs, rhs| lhs.id.cmp(&rhs.id)); | 32 | res.sort_by(|lhs, rhs| lhs.id.cmp(&rhs.id)); |
diff --git a/xtask/src/lib.rs b/xtask/src/lib.rs index babec2dbd..16b06b853 100644 --- a/xtask/src/lib.rs +++ b/xtask/src/lib.rs | |||
@@ -34,7 +34,11 @@ pub fn project_root() -> PathBuf { | |||
34 | .to_path_buf() | 34 | .to_path_buf() |
35 | } | 35 | } |
36 | 36 | ||
37 | pub fn rust_files(path: &Path) -> impl Iterator<Item = PathBuf> { | 37 | pub fn rust_files() -> impl Iterator<Item = PathBuf> { |
38 | rust_files_in(&project_root().join("crates")) | ||
39 | } | ||
40 | |||
41 | pub fn rust_files_in(path: &Path) -> impl Iterator<Item = PathBuf> { | ||
38 | let iter = WalkDir::new(path); | 42 | let iter = WalkDir::new(path); |
39 | return iter | 43 | return iter |
40 | .into_iter() | 44 | .into_iter() |
diff --git a/xtask/tests/tidy.rs b/xtask/tests/tidy.rs index 6abad189a..9a6933b09 100644 --- a/xtask/tests/tidy.rs +++ b/xtask/tests/tidy.rs | |||
@@ -82,7 +82,7 @@ Please adjust docs/dev/lsp-extensions.md. | |||
82 | #[test] | 82 | #[test] |
83 | fn rust_files_are_tidy() { | 83 | fn rust_files_are_tidy() { |
84 | let mut tidy_docs = TidyDocs::default(); | 84 | let mut tidy_docs = TidyDocs::default(); |
85 | for path in rust_files(&project_root().join("crates")) { | 85 | for path in rust_files() { |
86 | let text = read_file(&path).unwrap(); | 86 | let text = read_file(&path).unwrap(); |
87 | check_todo(&path, &text); | 87 | check_todo(&path, &text); |
88 | check_dbg(&path, &text); | 88 | check_dbg(&path, &text); |