You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think requiring this when calling known-panicky functions is extreme. Often something is unwrapped because it is expected to never fail. That's not something you can explain to the caller. "This function panics if... the code is wrong"?
Requiring a "Panics" section if the function uses specifically panic! would be good. If it can panic, it should be documented. If it can't panic, they should have used unreachable! instead.
Instead, this happened:
Warnings:
error: docs for function which may panic missing `# Panics` section
--> $DIR/doc_panics.rs:98:1
|
LL | / pub fn unreachable() {
LL | | unreachable!("This function panics")
LL | | }
| |_^
|
note: first possible panic found here
--> $DIR/doc_panics.rs:99:5
|
LL | unreachable!("This function panics")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
Lint name:
missing_panics_doc
I tried this code:
I expected to see this happen:
No warning.
As noted by @dtolnay in #1791 (comment):
Instead, this happened:
Warnings:
Meta
cargo clippy -V
: clippy 0.1.51 (3682750 2021-02-02)rustc -Vv
:The text was updated successfully, but these errors were encountered: