Closed
Description
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.