since & is Copy, just suggest to use Option<&T>
This applies to &mut Option<&mut T> too, because as_ref and as_mut exist. Ditto for Result.
This applies to
&mut Option<&mut T>too
Does it though? With a &mut Option<T>, I could mem::replace or mem::swap it with a completely different option, or call Option::take on it, which does the same thing internally.
@shepmaster I think you misunderstood; &mut Option<&mut T> should be written as Option<&mut T>, not &mut Option<T>. This is very similar to writing &&T instead of &T.
I think you misunderstood;
&mut Option<&mut T>should be written asOption<&mut T>, not &mut Option.
@shepmaster's comment still applies. You cannot set the shared Option to None with Option<&mut T>
Most helpful comment
@shepmaster's comment still applies. You cannot set the shared
OptiontoNonewithOption<&mut T>