Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False-positive for missing_safety_doc with block-comments #5731

Closed
snyball opened this issue Jun 18, 2020 · 2 comments
Closed

False-positive for missing_safety_doc with block-comments #5731

snyball opened this issue Jun 18, 2020 · 2 comments

Comments

@snyball
Copy link

snyball commented Jun 18, 2020

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.

@flip1995
Copy link
Member

Duplicate of #5593

@flip1995 flip1995 marked this as a duplicate of #5593 Jun 22, 2020
@flip1995
Copy link
Member

A fix is on its way: #5659

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants