Skip to content

[missing_panics_doc] doesn't trigger on expect #10240

@wookietreiber

Description

@wookietreiber

Summary

Doesn't trigger on expect. Noticed when changing from unwrap to expect to provide a better message, and the lint was suddenly gone.

Lint Name

missing_panics_doc

Reproducer

I tried this code:

#[deny(clippy::missing_panics_doc)]

pub fn last_unwrap(v: &[u32]) -> u32 {
    *v.last().unwrap()
}

pub fn last_expect(v: &[u32]) -> u32 {
    *v.last().expect("passed an empty thing")
}

I expected to see this happen: issue error for both last_unwrap and last_expect.

Instead, this happened:

missing-panics-doc-expect

Version

rustc 1.67.0 (fc594f156 2023-01-24)
binary: rustc
commit-hash: fc594f15669680fa70d255faec3ca3fb507c3405
commit-date: 2023-01-24
host: x86_64-unknown-linux-gnu
release: 1.67.0
LLVM version: 15.0.6

Metadata

Metadata

Labels

C-bugCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn't

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions