Best practice when using .unwrap()
in production code is to put a line of documentation immediately above the use of .unwrap()
that describes the safety invariants which allow the unwrap to be safe.
Since code churn could eventually cause those safety invariants to be violated, I think it’s not a bad thing for a blunt audit of .unwrap()
to bring your attention to those cases and prompt to reevaluate if the invariants are still satisfied.
OP really needs to heed this advice. Modifying things in the cache will cause breakages that will confuse the hell out of you.