File tree 2 files changed +9
-9
lines changed
2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -497,13 +497,15 @@ impl<T> Once<T> {
497
497
/// If the value was already initialized the closure is not called and `false` is returned,
498
498
/// otherwise if the value from the closure initializes the inner value, `true` is returned
499
499
#[ inline]
500
- pub fn init_locking < F : FnOnce ( ) -> T > ( & self , f : F ) -> bool {
501
- let mut lock = self . 0 . lock ( ) ;
502
- if lock. is_some ( ) {
503
- return false ;
500
+ pub fn init_locking < F : FnOnce ( ) -> T > ( & self , f : F ) -> & T {
501
+ {
502
+ let mut lock = self . 0 . lock ( ) ;
503
+ if lock. is_none ( ) {
504
+ * lock = Some ( f ( ) ) ;
505
+ }
504
506
}
505
- * lock = Some ( f ( ) ) ;
506
- true
507
+
508
+ self . borrow ( )
507
509
}
508
510
509
511
/// Tries to initialize the inner value by calling the closure without ensuring that no-one
Original file line number Diff line number Diff line change @@ -1351,9 +1351,7 @@ impl<'a, 'tcx> CrateMetadata {
1351
1351
translated_source_file : local_version,
1352
1352
}
1353
1353
} ) . collect ( )
1354
- } ) ;
1355
-
1356
- self . source_map_import_info . borrow ( )
1354
+ } )
1357
1355
}
1358
1356
1359
1357
/// Get the `DepNodeIndex` corresponding this crate. The result of this
You can’t perform that action at this time.
0 commit comments