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

missing_panics_doc is issued for debug_assert! #6970

Closed
Licenser opened this issue Mar 25, 2021 · 2 comments · Fixed by #6996
Closed

missing_panics_doc is issued for debug_assert! #6970

Licenser opened this issue Mar 25, 2021 · 2 comments · Fixed by #6996
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have

Comments

@Licenser
Copy link
Contributor

Lint name:

missing_panics_doc

I tried this code:

    /// merge the other `ids` into this one
    pub fn merge(&mut self, ids: &TrackedEventIds) {
        debug_assert!(self.source_id == ids.source_id, "incompatible source ids");
        debug_assert!(self.stream_id == ids.stream_id, "incompatible stream ids");
        // self.track_ids(ids.min_event_id, ids.max_event_id); this line is commented out to guarantee that the panic is really in debug_assert!
    }```

I expected to see this happen: `debug_assert!` not be considered a panic since it is for debug compilations

Instead, this happened: This function is considered panicking by clippy

### Meta

- `cargo clippy -V`: `clippy 0.1.51 (2fd73fa 2021-03-23)`
- `rustc -Vv`:

rustc 1.51.0 (2fd73fabe 2021-03-23)
binary: rustc
commit-hash: 2fd73fabe469357a12c2c974c140f67e7cdd76d0
commit-date: 2021-03-23
host: x86_64-unknown-linux-gnu
release: 1.51.0
LLVM version: 11.0.1

@Licenser Licenser added C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have labels Mar 25, 2021
@bors bors closed this as completed in 0e06b3c Mar 29, 2021
@lopopolo
Copy link

I think I previously reported this here when this change landed on nightly: #6739.

Sorry for not doing a more thorough investigation.

This false positive triggered in 3+ crates that I maintain.

Is doing crater-style runs for new clippy lints to test for false positives something that can be considered before new lints make it to stable?

@Licenser
Copy link
Contributor Author

Licenser commented Apr 9, 2021

Ja I saw your bug report but the comment suggested that it was related to something else :). It seems it got fixed by @Y-Nak. Thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have
Projects
None yet
2 participants