mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 21:13:37 +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 hir_def::{AdtId, EnumVariantId, ModuleDefId};
|
||||||
|
|
||||||
use crate::{Adt, EnumVariant, ModuleDef};
|
use crate::{Adt, EnumVariant, ModuleDef};
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//! Diagnostics produced by `hir_def`.
|
||||||
|
|
||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
|
|
||||||
use hir_expand::diagnostics::Diagnostic;
|
use hir_expand::diagnostics::Diagnostic;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//! Database used for testing `hir_def`.
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
panic,
|
panic,
|
||||||
sync::{Arc, Mutex},
|
sync::{Arc, Mutex},
|
||||||
|
|
|
@ -36,6 +36,7 @@ fn is_hidden(entry: &DirEntry) -> bool {
|
||||||
fn no_docs_comments() {
|
fn no_docs_comments() {
|
||||||
let crates = project_root().join("crates");
|
let crates = project_root().join("crates");
|
||||||
let iter = WalkDir::new(crates);
|
let iter = WalkDir::new(crates);
|
||||||
|
let mut missing_docs = Vec::new();
|
||||||
for f in iter.into_iter().filter_entry(|e| !is_hidden(e)) {
|
for f in iter.into_iter().filter_entry(|e| !is_hidden(e)) {
|
||||||
let f = f.unwrap();
|
let f = f.unwrap();
|
||||||
if f.file_type().is_dir() {
|
if f.file_type().is_dir() {
|
||||||
|
@ -54,12 +55,14 @@ fn no_docs_comments() {
|
||||||
let mut line = String::new();
|
let mut line = String::new();
|
||||||
reader.read_line(&mut line).unwrap();
|
reader.read_line(&mut line).unwrap();
|
||||||
if !line.starts_with("//!") {
|
if !line.starts_with("//!") {
|
||||||
|
missing_docs.push(f.path().display().to_string());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !missing_docs.is_empty() {
|
||||||
panic!(
|
panic!(
|
||||||
"\nMissing docs strings\n\
|
"\nMissing docs strings\n\n\
|
||||||
module: {}\n\
|
modules:\n{}\n\n",
|
||||||
Need add doc for module\n",
|
missing_docs.join("\n")
|
||||||
f.path().display()
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue