1 point
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.