From 8922a44395482896fec0c0a47a7fac4612112d45 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 4 Nov 2019 00:11:37 +0300 Subject: [PATCH] Add small module-level docs --- crates/ra_hir/src/from_id.rs | 5 +++++ crates/ra_hir_def/src/diagnostics.rs | 2 ++ crates/ra_hir_def/src/test_db.rs | 2 ++ xtask/tests/tidy-tests/docs.rs | 15 +++++++++------ 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/crates/ra_hir/src/from_id.rs b/crates/ra_hir/src/from_id.rs index c08203bca7..089dbc9084 100644 --- a/crates/ra_hir/src/from_id.rs +++ b/crates/ra_hir/src/from_id.rs @@ -1,3 +1,8 @@ +//! Utility module for converting between hir_def ids and code_model wrappers. +//! +//! It's unclear if we need this long-term, but it's definitelly useful while we +//! are splitting the hir. + use hir_def::{AdtId, EnumVariantId, ModuleDefId}; use crate::{Adt, EnumVariant, ModuleDef}; diff --git a/crates/ra_hir_def/src/diagnostics.rs b/crates/ra_hir_def/src/diagnostics.rs index 637184c582..1c1ccdecb7 100644 --- a/crates/ra_hir_def/src/diagnostics.rs +++ b/crates/ra_hir_def/src/diagnostics.rs @@ -1,3 +1,5 @@ +//! Diagnostics produced by `hir_def`. + use std::any::Any; use hir_expand::diagnostics::Diagnostic; diff --git a/crates/ra_hir_def/src/test_db.rs b/crates/ra_hir_def/src/test_db.rs index 05018f8e43..f91a5b41df 100644 --- a/crates/ra_hir_def/src/test_db.rs +++ b/crates/ra_hir_def/src/test_db.rs @@ -1,3 +1,5 @@ +//! Database used for testing `hir_def`. + use std::{ panic, sync::{Arc, Mutex}, diff --git a/xtask/tests/tidy-tests/docs.rs b/xtask/tests/tidy-tests/docs.rs index 6a629ce63e..227937f462 100644 --- a/xtask/tests/tidy-tests/docs.rs +++ b/xtask/tests/tidy-tests/docs.rs @@ -36,6 +36,7 @@ fn is_hidden(entry: &DirEntry) -> bool { fn no_docs_comments() { let crates = project_root().join("crates"); let iter = WalkDir::new(crates); + let mut missing_docs = Vec::new(); for f in iter.into_iter().filter_entry(|e| !is_hidden(e)) { let f = f.unwrap(); if f.file_type().is_dir() { @@ -54,12 +55,14 @@ fn no_docs_comments() { let mut line = String::new(); reader.read_line(&mut line).unwrap(); if !line.starts_with("//!") { - panic!( - "\nMissing docs strings\n\ - module: {}\n\ - Need add doc for module\n", - f.path().display() - ) + missing_docs.push(f.path().display().to_string()); } } + if !missing_docs.is_empty() { + panic!( + "\nMissing docs strings\n\n\ + modules:\n{}\n\n", + missing_docs.join("\n") + ) + } }