From feb252138d561075116119d9aa84a21b7244e471 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 21 Jan 2021 16:37:08 +0300 Subject: Fix mega bug https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Manual.20content.20is.20duplicated --- xtask/src/codegen/gen_assists_docs.rs | 4 ++-- xtask/src/codegen/gen_diagnostic_docs.rs | 2 +- xtask/src/codegen/gen_feature_docs.rs | 2 +- xtask/src/lib.rs | 6 +++++- xtask/tests/tidy.rs | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) (limited to 'xtask') 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}; use crate::{ codegen::{self, extract_comment_blocks_with_empty_lines, reformat, Location, Mode, PREAMBLE}, - project_root, rust_files, Result, + project_root, rust_files_in, Result, }; pub fn generate_assists_tests(mode: Mode) -> Result<()> { @@ -32,7 +32,7 @@ struct Assist { impl Assist { fn collect() -> Result> { let mut res = Vec::new(); - for path in rust_files(&project_root().join("crates/assists/src/handlers")) { + for path in rust_files_in(&project_root().join("crates/assists/src/handlers")) { collect_file(&mut res, path.as_path())?; } 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 { impl Diagnostic { fn collect() -> Result> { let mut res = Vec::new(); - for path in rust_files(&project_root()) { + for path in rust_files() { collect_file(&mut res, path)?; } 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 { impl Feature { fn collect() -> Result> { let mut res = Vec::new(); - for path in rust_files(&project_root()) { + for path in rust_files() { collect_file(&mut res, path)?; } 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 { .to_path_buf() } -pub fn rust_files(path: &Path) -> impl Iterator { +pub fn rust_files() -> impl Iterator { + rust_files_in(&project_root().join("crates")) +} + +pub fn rust_files_in(path: &Path) -> impl Iterator { let iter = WalkDir::new(path); return iter .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. #[test] fn rust_files_are_tidy() { let mut tidy_docs = TidyDocs::default(); - for path in rust_files(&project_root().join("crates")) { + for path in rust_files() { let text = read_file(&path).unwrap(); check_todo(&path, &text); check_dbg(&path, &text); -- cgit v1.2.3