Clippy lints / Suspicious
Clippy lint · Suspicious · checked with Clippy 0.1.99
clippy::four_forward_slashes: this item has comments with 4 forward slashes (`////`). These look like doc comments, but they aren't
What it meansChecks for outer doc comments written with 4 forward slashes (////). It is in the suspicious group and warns by default.
What you see
warning: this item has comments with 4 forward slashes (`////`). These look like doc comments, but they aren't --> main.rs:3:1 | 3 | / //// My amazing data structure 4 | | pub struct Foo { | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/stable/index.html#four_forward_slashes = note: `#[warn(clippy::four_forward_slashes)]` on by default help: make this a doc comment by removing one `/` | 3 - //// My amazing data structure 4 - pub struct Foo { 3 + /// My amazing data structure |
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?
This is (probably) a typo, and results in it not being a doc comment; just a regular comment.
Code that is most likely wrong or useless. Warns by default.
How to fix it
Clippy can fix this one for you: run cargo clippy --fix (add --allow-dirty if you have uncommitted changes). Review the diff before you commit.
Flagged
//// My amazing data structure
pub struct Foo {
// ...
}
Write this instead
/// My amazing data structure
pub struct Foo {
// ...
}
Turn it off, or on
Allow it where it does not fit your code, as narrowly as you can:
On one item
#[allow(clippy::four_forward_slashes)]
fn my_function() { /* ... */ }Whole crate (Cargo.toml)
[lints.clippy]
four_forward_slashes = "allow"One run
cargo clippy -- -A clippy::four-forward-slashesThe [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
Checks for outer doc comments written with 4 forward slashes (////).
Why is this bad?
This is (probably) a typo, and results in it not being a doc comment; just a regular comment.
Example
//// My amazing data structure
pub struct Foo {
// ...
}
Use instead:
/// My amazing data structure
pub struct Foo {
// ...
}
From the Clippy lint list (0.1.99), part of the Rust project, MIT or Apache-2.0. Official entry.
Related lints
- float_equality_without_absfloat equality check without `.abs()`
- for_unbounded_rangefor loop on unbounded range
- forget_non_dropcall to `std::mem::forget` with a value that does not implement `Drop`. Forgetting such a type is the same as dropping it
- from_raw_with_void_ptrChecks if we’re passing a c_void raw pointer to {Box,Rc,Arc,Weak}::from_raw(_)
- incompatible_msrvThis lint checks that no function newer than the defined MSRV (minimum supported rust version) is used in the crate
- ineffective_open_optionsChecks if both .write(true) and .append(true) methods are called on a same OpenOptions
All 847 Clippy lints · Rust compiler errors · Cargo.toml checker
Up next
Related lintclippy::float_equality_without_absfloat equality check without `.abs()`Read it next →Did this answer your question?