File tree Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -837,9 +837,8 @@ impl<T> Option<T> {
837837 #[ inline]
838838 #[ stable( feature = "option_entry" , since = "1.20.0" ) ]
839839 pub fn get_or_insert_with < F : FnOnce ( ) -> T > ( & mut self , f : F ) -> & mut T {
840- match * self {
841- None => * self = Some ( f ( ) ) ,
842- _ => ( ) ,
840+ if let None = * self {
841+ * self = Some ( f ( ) ) ;
843842 }
844843
845844 match * self {
Original file line number Diff line number Diff line change @@ -509,9 +509,8 @@ pub mod os {
509509 pub unsafe fn get ( & ' static self , init : fn ( ) -> T ) -> Option < & ' static T > {
510510 let ptr = self . os . get ( ) as * mut Value < T > ;
511511 if ptr as usize > 1 {
512- match ( * ptr) . inner . get ( ) {
513- Some ( ref value) => return Some ( value) ,
514- None => { } ,
512+ if let Some ( ref value) = ( * ptr) . inner . get ( ) {
513+ return Some ( value) ;
515514 }
516515 }
517516 self . try_initialize ( init)
You can’t perform that action at this time.
0 commit comments