File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ impl Waker {
4242 /// `Arc` type and the safe `Wake` trait.
4343 #[ inline]
4444 pub unsafe fn new ( inner : NonNull < dyn UnsafeWake > ) -> Self {
45- Waker { inner : inner }
45+ Waker { inner }
4646 }
4747
4848 /// Wake up the task associated with this `Waker`.
@@ -120,7 +120,7 @@ impl LocalWaker {
120120 /// on the current thread.
121121 #[ inline]
122122 pub unsafe fn new ( inner : NonNull < dyn UnsafeWake > ) -> Self {
123- LocalWaker { inner : inner }
123+ LocalWaker { inner }
124124 }
125125
126126 /// Wake up the task associated with this `LocalWaker`.
@@ -159,17 +159,15 @@ impl LocalWaker {
159159impl From < LocalWaker > for Waker {
160160 #[ inline]
161161 fn from ( local_waker : LocalWaker ) -> Self {
162- Waker { inner : local_waker. inner }
162+ unsafe { mem :: transmute :: < LocalWaker , Waker > ( local_waker) }
163163 }
164164}
165165
166166impl Clone for LocalWaker {
167167 #[ inline]
168168 fn clone ( & self ) -> Self {
169169 let waker = unsafe { self . inner . as_ref ( ) . clone_raw ( ) } ;
170- let inner = waker. inner ;
171- mem:: forget ( waker) ;
172- LocalWaker { inner }
170+ unsafe { mem:: transmute :: < Waker , LocalWaker > ( waker) }
173171 }
174172}
175173
You can’t perform that action at this time.
0 commit comments