Closed
Description
When scanning comments for a # Safety
section, clippy only
recognizes up to three spaces for indentation. Example:
/** This safety section is not recognized.
# Safety
No risk, no fun.
*/
pub unsafe extern "C" fn danger_ignored(_p: *const libc::c_char) { unimplemented!(); }
/** This one is recognized.
# Safety
No risk, no fun.
*/
pub unsafe extern "C" fn danger_realized(_p: *const libc::c_char) { unimplemented!(); }
The first function triggers clippy::missing_safety_doc
despite the safety section being present. This is annoying
in that four spaces are required to align with the first
line of a doc comment (/**
):
$ cargo clippy -V
clippy 0.0.212
$ cargo clippy
Checking clip-comment v0.1.0 (/src/rust-dev/playground/clip-comment)
warning: unsafe function's docs miss `# Safety` section
--> src/main.rs:7:1
|
7 | pub unsafe extern "C" fn danger_ignored(_p: *const libc::c_char) { unimplemented!(); }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(clippy::missing_safety_doc)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_safety_doc
Finished dev [unoptimized + debuginfo] target(s) in 0.16s
The lint can either be disabled or enabled, but not tweaked to
match the comment style. It would be preferable if a global base
indentation level for comment continuations could be specified
instead.