Add small module-level docs

This commit is contained in:
Aleksey Kladov 2019-11-04 00:11:37 +03:00
parent f0eb9cc6e6
commit 8922a44395
4 changed files with 18 additions and 6 deletions

View file

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

View file

@ -1,3 +1,5 @@
//! Diagnostics produced by `hir_def`.
use std::any::Any;
use hir_expand::diagnostics::Diagnostic;

View file

@ -1,3 +1,5 @@
//! Database used for testing `hir_def`.
use std::{
panic,
sync::{Arc, Mutex},

View file

@ -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("//!") {
missing_docs.push(f.path().display().to_string());
}
}
if !missing_docs.is_empty() {
panic!(
"\nMissing docs strings\n\
module: {}\n\
Need add doc for module\n",
f.path().display()
"\nMissing docs strings\n\n\
modules:\n{}\n\n",
missing_docs.join("\n")
)
}
}
}