We use the unwrap and expect methods on Option and Result a lot, and these panic on failure. This causes problems for debugging just as explicit panics/assertion failures do. Thus, we should add unwrap and expect implementations to alloc-fmt that use alloc-fmt's panic so that we can use them in a global-allocator-safe manner.
Probably the easiest way to do this is to have a trait with default impls for Option and Result with alloc_unwrap and alloc_expect methods. That way, we'd only need to import this trait in order to add those methods to Option and Result.
We use the
unwrap
andexpect
methods onOption
andResult
a lot, and these panic on failure. This causes problems for debugging just as explicit panics/assertion failures do. Thus, we should addunwrap
andexpect
implementations toalloc-fmt
that usealloc-fmt
'spanic
so that we can use them in a global-allocator-safe manner.Probably the easiest way to do this is to have a trait with default impls for
Option
andResult
withalloc_unwrap
andalloc_expect
methods. That way, we'd only need to import this trait in order to add those methods toOption
andResult
.