@@ -64,7 +64,7 @@ impl Mutex {
64
64
match kind ( ) {
65
65
Kind :: SRWLock => c:: AcquireSRWLockExclusive ( raw ( self ) ) ,
66
66
Kind :: CriticalSection => {
67
- let inner = & mut * self . inner ( ) ;
67
+ let inner = & * self . inner ( ) ;
68
68
inner. remutex . lock ( ) ;
69
69
if inner. held . replace ( true ) {
70
70
// It was already locked, so we got a recursive lock which we do not want.
@@ -78,7 +78,7 @@ impl Mutex {
78
78
match kind ( ) {
79
79
Kind :: SRWLock => c:: TryAcquireSRWLockExclusive ( raw ( self ) ) != 0 ,
80
80
Kind :: CriticalSection => {
81
- let inner = & mut * self . inner ( ) ;
81
+ let inner = & * self . inner ( ) ;
82
82
if !inner. remutex . try_lock ( ) {
83
83
false
84
84
} else if inner. held . replace ( true ) {
@@ -95,7 +95,7 @@ impl Mutex {
95
95
match kind ( ) {
96
96
Kind :: SRWLock => c:: ReleaseSRWLockExclusive ( raw ( self ) ) ,
97
97
Kind :: CriticalSection => {
98
- let inner = & mut * ( self . lock . load ( Ordering :: SeqCst ) as * mut Inner ) ;
98
+ let inner = & * ( self . lock . load ( Ordering :: SeqCst ) as * const Inner ) ;
99
99
inner. held . set ( false ) ;
100
100
inner. remutex . unlock ( ) ;
101
101
}
@@ -106,17 +106,15 @@ impl Mutex {
106
106
Kind :: SRWLock => { }
107
107
Kind :: CriticalSection => match self . lock . load ( Ordering :: SeqCst ) {
108
108
0 => { }
109
- n => {
110
- Box :: from_raw ( n as * mut Inner ) . remutex . destroy ( ) ;
111
- }
109
+ n => Box :: from_raw ( n as * mut Inner ) . remutex . destroy ( ) ,
112
110
} ,
113
111
}
114
112
}
115
113
116
- unsafe fn inner ( & self ) -> * mut Inner {
114
+ unsafe fn inner ( & self ) -> * const Inner {
117
115
match self . lock . load ( Ordering :: SeqCst ) {
118
116
0 => { }
119
- n => return n as * mut _ ,
117
+ n => return n as * const _ ,
120
118
}
121
119
let inner = box Inner { remutex : ReentrantMutex :: uninitialized ( ) , held : Cell :: new ( false ) } ;
122
120
inner. remutex . init ( ) ;
@@ -125,7 +123,7 @@ impl Mutex {
125
123
0 => inner,
126
124
n => {
127
125
Box :: from_raw ( inner) . remutex . destroy ( ) ;
128
- n as * mut _
126
+ n as * const _
129
127
}
130
128
}
131
129
}
0 commit comments