#rustlang hot take: We should rename .unwrap() to .or_panic(). (And .expect() to .or_panic_with().) "Unwrap" is a terrible name for the panicking function, especially since we also have things like .unwrap_or() and .unwrap_or_default() which never panic.
(That the name "or_panic" would have been better isn't much of a hot take, but adding "or_panic()" now and deprecating "unwrap()" would likely be controversial.)
I think it would be fine but the deprecation lint would have to start being enforced in next edition and I don't think .unwrap*() could be truly deprecated for the next few editions

@Mara

@pj @Mara what about a lint that force every line that could panic to be preceded by a `// PANIC:` comment block, like the one for unsafe:

https://rust-lang.github.io/rust-clippy/master/index.html#undocumented_unsafe_blocks

If they can panic. And if they can't: `#[expect(clippy::missing_panics_doc, reason = "infallible")]`

https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc

That way, any panic hidden in a function call should become visible.

Clippy Lints

A collection of lints to catch common mistakes and improve your Rust code.