File tree 2 files changed +4
-6
lines changed
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> {
837
837
#[ inline]
838
838
#[ stable( feature = "option_entry" , since = "1.20.0" ) ]
839
839
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 ( ) ) ;
843
842
}
844
843
845
844
match * self {
Original file line number Diff line number Diff line change @@ -509,9 +509,8 @@ pub mod os {
509
509
pub unsafe fn get ( & ' static self , init : fn ( ) -> T ) -> Option < & ' static T > {
510
510
let ptr = self . os . get ( ) as * mut Value < T > ;
511
511
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) ;
515
514
}
516
515
}
517
516
self . try_initialize ( init)
You can’t perform that action at this time.
0 commit comments