Clippy lints / Suspicious
Clippy lint · Suspicious · checked with Clippy 0.1.99
clippy::empty_docs: empty doc comment
What it meansDetects documentation that is empty. It is in the suspicious group and warns by default.
What you see
warning: empty doc comment --> main.rs:3:1 | 3 | /// | ^^^ | = help: consider removing or filling it = help: for further information visit https://rust-lang.github.io/rust-clippy/stable/index.html#empty_docs = note: `#[warn(clippy::empty_docs)]` on by default
Real output of Clippy 0.1.99 (Rust 1.99) on the example below. Names and line numbers in yours will differ.
Does it matter?
Empty docs clutter code without adding value, reducing readability and maintainability.
Code that is most likely wrong or useless. Warns by default.
How to fix it
Clippy does not fix this one automatically. Change the code by hand:
Flagged
///
fn returns_true() -> bool {
true
}
Write this instead
fn returns_true() -> bool {
true
}
Turn it off, or on
Allow it where it does not fit your code, as narrowly as you can:
On one item
#[allow(clippy::empty_docs)]
fn my_function() { /* ... */ }Whole crate (Cargo.toml)
[lints.clippy]
empty_docs = "allow"One run
cargo clippy -- -A clippy::empty-docsThe [lints] table needs Rust 1.74 or newer. In a workspace, put it under [workspace.lints.clippy] and add [lints] workspace = true to each member.
Clippy's own documentation
What it does
Detects documentation that is empty.
Why is this bad?
Empty docs clutter code without adding value, reducing readability and maintainability.
Example
///
fn returns_true() -> bool {
true
}
Use instead:
fn returns_true() -> bool {
true
}
From the Clippy lint list (0.1.99), part of the Rust project, MIT or Apache-2.0. Official entry.
Related lints
- drop_non_dropcall to `std::mem::drop` with a value that does not implement `Drop`. Dropping such a type only extends its contained lifetimes
- duplicate_modfile is loaded as a module multiple times: `main.rs`
- duplicated_attributesduplicated attribute
- empty_line_after_doc_commentsempty line after doc comment
- empty_line_after_outer_attrempty line after outer attribute
- empty_loopempty `loop {}` wastes CPU cycles
All 847 Clippy lints · Rust compiler errors · Cargo.toml checker
Up next
Related lintclippy::drop_non_dropcall to `std::mem::drop` with a value that does not implement `Drop`. Dropping such a type only extends its contained lifetimesRead it next →Did this answer your question?