From a7a0225a281bbb9306862e647aee2f51aa595086 Mon Sep 17 00:00:00 2001 From: Georg Semmler Date: Fri, 10 Aug 2018 14:21:17 +0200 Subject: [PATCH] Also add a `From` implementation for `&mut Option` -> `Option<&mut T>' --- src/libcore/option.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 883e01ff2a8..32a0a8b3c51 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -1071,6 +1071,13 @@ fn from(o: &'a Option) -> Option<&'a T> { } } +#[stable(feature = "option_ref_from_ref_option", since = "1.30.0")] +impl<'a, T> From<&'a mut Option> for Option<&'a mut T> { + fn from(o: &'a mut Option) -> Option<&'a mut T> { + o.as_mut() + } +} + ///////////////////////////////////////////////////////////////////////////// // The Option Iterators ///////////////////////////////////////////////////////////////////////////// -- 2.44.0