Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
get_or() currently works as a wrapper around get_or_try(). It wraps the result of the passed function into a Result<T, ()> and then calls unreachable_unchecked, which is an unsafe function. However, as an Err branch is never instantiated for this Result type, we can use the uninhabited Infallible type instead of the unit type. At this point it is 100% safe to unwrap the underlying result and match on the uninhabited error type to eliminate that branch. It turns out this was the only time that the "unreachable" module was used in the library, so I've also taken the liberty of deleting that file. Signed-off-by: John Nunley <dev@notgull.net>
- Loading branch information