12
12
// See the License for the specific language governing permissions and
13
13
// limitations under the License.
14
14
15
- use std:: collections:: HashMap ;
16
15
use std:: fmt:: Debug ;
17
- use std:: sync:: Mutex ;
18
16
19
17
use once_cell:: sync:: OnceCell ;
20
18
use state:: Container ;
@@ -27,7 +25,7 @@ pub enum Singleton {
27
25
Production ( Container ! [ Send + Sync ] ) ,
28
26
29
27
#[ cfg( debug_assertions) ]
30
- Testing ( Mutex < HashMap < String , Container ! [ Send + Sync ] > > ) ,
28
+ Testing ( std :: sync :: Mutex < std :: collections :: HashMap < String , Container ! [ Send + Sync ] > > ) ,
31
29
}
32
30
33
31
unsafe impl Send for Singleton { }
@@ -80,6 +78,7 @@ impl Debug for Singleton {
80
78
f. debug_struct ( "Singleton" )
81
79
. field ( "type" , & match self {
82
80
Self :: Production ( _) => "Production" ,
81
+ #[ cfg( debug_assertions) ]
83
82
Self :: Testing ( _) => "Testing" ,
84
83
} )
85
84
. finish ( )
@@ -105,7 +104,7 @@ impl Global {
105
104
/// Should only be initiated once and only used in testing.
106
105
#[ cfg( debug_assertions) ]
107
106
pub fn init_testing ( ) {
108
- let _ = GLOBAL . set ( Singleton :: Testing ( Mutex :: default ( ) ) ) ;
107
+ let _ = GLOBAL . set ( Singleton :: Testing ( std :: sync :: Mutex :: default ( ) ) ) ;
109
108
}
110
109
111
110
/// drop testing global data by thread name.
0 commit comments