Aleksey Kladov 2021-01-21 16:37:08 +03:00
parent 64a92e2328
commit feb252138d
5 changed files with 10 additions and 6 deletions

View file

@ -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<Vec<Assist>> {
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));

View file

@ -27,7 +27,7 @@ struct Diagnostic {
impl Diagnostic {
fn collect() -> Result<Vec<Diagnostic>> {
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));

View file

@ -26,7 +26,7 @@ struct Feature {
impl Feature {
fn collect() -> Result<Vec<Feature>> {
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));

View file

@ -34,7 +34,11 @@ pub fn project_root() -> PathBuf {
.to_path_buf()
}
pub fn rust_files(path: &Path) -> impl Iterator<Item = PathBuf> {
pub fn rust_files() -> impl Iterator<Item = PathBuf> {
rust_files_in(&project_root().join("crates"))
}
pub fn rust_files_in(path: &Path) -> impl Iterator<Item = PathBuf> {
let iter = WalkDir::new(path);
return iter
.into_iter()

View file

@ -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);