Skip to content

Detect documentation that is empty #9931

Closed
@i509VCB

Description

@i509VCB

What it does

Detects documentation that is empty.

Lint Name

empty-docs

Category

suspicious

Advantage

  • Empty docs are often pointless
  • The developer may have forgotten to fill in the documentation.

Drawbacks

  • Could result in the commonly used missing_docs lint being fired. However it should be possible to just use the attribute #[allow(missing_docs)] where needed.
  • If #[forbid(missing_docs] is enabled, removing the empty doc comments will fire the lint.
  • What applies as "empty documentation" would need to consider whitespace and possibly odd characters. Using str::is_whitespace would probably satisfy that case.

Example

//!

Could be written as (if #![warn(missing_docs)] or #![deny(missing_docs)]):

#![allow(missing_docs)]

or a message:

help: fill in the documentation

Could be written as (if missing_docs is not enabled)

If #[forbid(missing_docs)], then we probably should advise changing forbid to deny or show the message to fill in the documentation.

Metadata

Metadata

Assignees

Labels

A-lintArea: New lintsgood first issueThese issues are a good way to get started with Clippy

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions