You don’t need to fix bugs that never happen. Preventative medicine is good software engineering that will save you time in the long run.
Preventing bugs with defensive coding
Using Option and Result instead of panic!
In many other languages, exception handling is performed through try…catch blocks. Rust does not automatically provide this functionality, instead it encourages the programmer to explicitly localize all error handling.
In many Rust contexts, if you don’t want to deal with error handling, you always have the option to use panic!. This will immediately end the program and provide a short error message. Don't do this. Panicking is usually just a way of avoiding the responsibility of handling...