mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 20:43:21 +00:00
Add small module-level docs
This commit is contained in:
parent
f0eb9cc6e6
commit
8922a44395
4 changed files with 18 additions and 6 deletions
|
@ -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};
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
//! Diagnostics produced by `hir_def`.
|
||||
|
||||
use std::any::Any;
|
||||
|
||||
use hir_expand::diagnostics::Diagnostic;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
//! Database used for testing `hir_def`.
|
||||
|
||||
use std::{
|
||||
panic,
|
||||
sync::{Arc, Mutex},
|
||||
|
|
|
@ -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")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue