File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -54,19 +54,19 @@ impl<T: Any + Clone> CloneAny for T {
54
54
}
55
55
56
56
impl Clone for Box < CloneAny > {
57
- fn clone ( & self ) -> Box < CloneAny > { self . clone_any ( ) }
57
+ fn clone ( & self ) -> Box < CloneAny > { ( * * self ) . clone_any ( ) }
58
58
}
59
59
60
60
impl Clone for Box < CloneAny + Send > {
61
- fn clone ( & self ) -> Box < CloneAny + Send > { self . clone_any_send ( ) }
61
+ fn clone ( & self ) -> Box < CloneAny + Send > { ( * * self ) . clone_any_send ( ) }
62
62
}
63
63
64
64
impl Clone for Box < CloneAny + Sync > {
65
- fn clone ( & self ) -> Box < CloneAny + Sync > { self . clone_any_sync ( ) }
65
+ fn clone ( & self ) -> Box < CloneAny + Sync > { ( * * self ) . clone_any_sync ( ) }
66
66
}
67
67
68
68
impl Clone for Box < CloneAny + Send + Sync > {
69
- fn clone ( & self ) -> Box < CloneAny + Send + Sync > { self . clone_any_send_sync ( ) }
69
+ fn clone ( & self ) -> Box < CloneAny + Send + Sync > { ( * * self ) . clone_any_send_sync ( ) }
70
70
}
71
71
72
72
unsafe impl UnsafeAnyExt for CloneAny { }
Original file line number Diff line number Diff line change @@ -250,13 +250,13 @@ mod internals;
250
250
251
251
#[ cfg( test) ]
252
252
mod test {
253
- use super :: { TypeMap , SendMap , Key } ;
253
+ use super :: { TypeMap , CloneMap , SendMap , Key } ;
254
254
use super :: Entry :: { Occupied , Vacant } ;
255
255
256
256
#[ derive( Debug , PartialEq ) ]
257
257
struct KeyType ;
258
258
259
- #[ derive( Debug , PartialEq ) ]
259
+ #[ derive( Clone , Debug , PartialEq ) ]
260
260
struct Value ( u8 ) ;
261
261
262
262
impl Key for KeyType { type Value = Value ; }
@@ -303,4 +303,12 @@ mod test {
303
303
map. remove :: < KeyType > ( ) ;
304
304
assert ! ( !map. contains:: <KeyType >( ) ) ;
305
305
}
306
+
307
+ #[ test] fn test_clonemap ( ) {
308
+ let mut map: CloneMap = TypeMap :: custom ( ) ;
309
+ map. insert :: < KeyType > ( Value ( 10 ) ) ;
310
+ assert ! ( map. contains:: <KeyType >( ) ) ;
311
+ let cloned = map. clone ( ) ;
312
+ assert_eq ! ( map. get:: <KeyType >( ) , cloned. get:: <KeyType >( ) ) ;
313
+ }
306
314
}
You can’t perform that action at this time.
0 commit comments