Remove code inside debug_assert macro
Code inside debug_assert! is not called in release mode. In release mode all the debug_assert! is omitted so the code inside never runs.
https://doc.rust-lang.org/std/macro.debug_assert.html
I've moved all the code inside the debug_assert! call to outside and assign to a variable so the assert is done in development version but doesn't affects to the release version at all.
I've written an small example to show the problem with this macro: