The point of panics is that they should occur on programmer error, not on exceptional circumstances. A program that is correctly written will never panic, and the point of a panic is to alert the user that the program has a mistake in it.
A panic is assumed to be unrecoverable without a surrounding runtime. You can make that runtime and catch the panic for something like service respawning and logging the panic somewhere.
For something like a user application, crashing is the correct response to a panic.
@anselmschueler
There are coredumps etc already.
The problem is that the OS cannot know about any specific language's internals without getting quite bloated. It would work with an additional user-space runtime.
The question to a GUI is not *how* it presents an error, but *whether* it can handle it meaningfully. Of course, programmers are not perfect. I'm calling for self-discipline here where the mechanisms to avoid bubbling up panics already exist.
Reasoning here:
https://platform-system-interface.github.io/intel_fw/extend.html
@CyReVolt Without reading the issue, my guess is that its quite complex depending on the interpretation: Is the intention to remind yourself to not use unwrap/expect in your own code? In that case, do you need a lint? It would be nice to have ofc, but a grep for unwrap\( and expect\( would cover that too.
But if the intention is to forbid panics, no matter how deep they happen, well, now you have a whole different beast on your hands. At the point clippy can access, every array[i] is a potential panic, for example, even if its surrounded in a explicit check that returns a Result/Option. Because you kinda need optimisations to understand "oh its already checked, we can skip the bounds check for the index access". That's why https://docs.rs/no-panic/latest/no_panic/ is optimization-level dependent, and code compiled in release might pass it while in debug it might find a panic.
Anyways, gonna look at the issue now and see how right i was.
unwrap_used and expect_used. The issue authors usecase is covered already, so i think the issue is left open for the suboptimal messages for unwrap_used telling people to use expect, and maybe because people keep asking to enable them by default.@laund Thank you for the hint toward no_panic!
I am collecting notes here atm, also adding unwrap_in_result:
https://github.com/platform-system-interface/intel_fw/issues/172