I don't know if I am missing something, but I just stumbled upon a minor papercut in
I have two variables
opt: &'a mut Option<T> and
value: T. I want to unconditionally assign
*opt and then return a mutable reference to the value inside opt (so the return type is
&'a mut T).
This should be possible without an unwrap, but I don't know how.
Option::get_or_insert only inserts when the old value is
If there is no such method, would it be worthwhile to create an issue/PR/RFC against the standard library? There are already many convenience methods fixing similar papercuts.