Skip to content

False-positive for missing_safety_doc with block-comments #5731

Closed
@snyball

Description

@snyball

With the following code:

/**
 * Drop an external reference
 *
 * # Arguments
 *
 * - `id` : Reference ID
 *
 * # Safety
 *
 * Using the reference after it has been dropped is UB.
 */
pub unsafe fn drop_ext(&mut self, id: u32) {
    self.extref.remove(&id);
}

I get this warning:

warning: unsafe function's docs miss `# Safety` section
   --> src/nkgc.rs:779:5
    |
779 | /     pub unsafe fn drop_ext(&mut self, id: u32) {
780 | |         self.extref.remove(&id);
781 | |     }
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_safety_doc

This code does not result in a clippy warning:

///
/// Drop an external reference
///
/// # Arguments
///
/// - `id` : Reference ID
///
/// # Safety
///
/// Using the reference after it has been dropped is UB.
///
pub unsafe fn drop_ext(&mut self, id: u32) {
    self.extref.remove(&id);
}

Given that /** ... */-style doc-comments are supported by rustdoc, I would expect them to be supported by clippy as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions