Skip to content
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Cannot retrieve contributors at this time
//! Check that private traits, impls, functions and const items have docs
use syntax::ast::{Item, ItemKind, Visibility};
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass, LintContext};
declare_lint!(PRIV_MISSING_DOCS, Warn,
"Warn about private traits, impls, functions and const items without \
pub struct Pass;
impl LintPass for Pass {
fn get_lints(&self) -> LintArray {
impl EarlyLintPass for Pass {
fn check_item(&mut self, cx: &EarlyContext, i: &Item) {
match i.node {
ItemKind::Const(..) | ItemKind::Fn(..) |
ItemKind::Impl(..) | ItemKind::Trait(..) |
ItemKind::Struct(..) | ItemKind::Enum(..) |
ItemKind::Mod(..) => {
if let Visibility::Public = i.vis {
// Publicly visible items are handled by other lints
let doc_found = i.attrs.iter().find(
|a| a.node.is_sugared_doc);
if let None = doc_found {
cx.span_lint(PRIV_MISSING_DOCS, i.span,
"private item is missing documentation");
_ => return,