@@ -3,7 +3,7 @@ use std::collections::HashMap;
3
3
use std:: hash:: { BuildHasherDefault , Hasher } ;
4
4
use std:: fmt;
5
5
6
- type AnyMap = HashMap < TypeId , Box < Any + Send + Sync > , BuildHasherDefault < IdHasher > > ;
6
+ type AnyMap = HashMap < TypeId , Box < dyn Any + Send + Sync > , BuildHasherDefault < IdHasher > > ;
7
7
8
8
// With TypeIds as keys, there's no need to hash them. They are already hashes
9
9
// themselves, coming from the compiler. The IdHasher just holds the u64 of
@@ -70,7 +70,7 @@ impl Extensions {
70
70
. insert ( TypeId :: of :: < T > ( ) , Box :: new ( val) )
71
71
. and_then ( |boxed| {
72
72
//TODO: we can use unsafe and remove double checking the type id
73
- ( boxed as Box < Any + ' static > )
73
+ ( boxed as Box < dyn Any + ' static > )
74
74
. downcast ( )
75
75
. ok ( )
76
76
. map ( |boxed| * boxed)
@@ -95,7 +95,7 @@ impl Extensions {
95
95
. as_ref ( )
96
96
. and_then ( |map| map. get ( & TypeId :: of :: < T > ( ) ) )
97
97
//TODO: we can use unsafe and remove double checking the type id
98
- . and_then ( |boxed| ( & * * boxed as & ( Any + ' static ) ) . downcast_ref ( ) )
98
+ . and_then ( |boxed| ( & * * boxed as & ( dyn Any + ' static ) ) . downcast_ref ( ) )
99
99
}
100
100
101
101
/// Get a mutable reference to a type previously inserted on this `Extensions`.
@@ -116,7 +116,7 @@ impl Extensions {
116
116
. as_mut ( )
117
117
. and_then ( |map| map. get_mut ( & TypeId :: of :: < T > ( ) ) )
118
118
//TODO: we can use unsafe and remove double checking the type id
119
- . and_then ( |boxed| ( & mut * * boxed as & mut ( Any + ' static ) ) . downcast_mut ( ) )
119
+ . and_then ( |boxed| ( & mut * * boxed as & mut ( dyn Any + ' static ) ) . downcast_mut ( ) )
120
120
}
121
121
122
122
@@ -140,7 +140,7 @@ impl Extensions {
140
140
. and_then ( |map| map. remove ( & TypeId :: of :: < T > ( ) ) )
141
141
. and_then ( |boxed| {
142
142
//TODO: we can use unsafe and remove double checking the type id
143
- ( boxed as Box < Any + ' static > )
143
+ ( boxed as Box < dyn Any + ' static > )
144
144
. downcast ( )
145
145
. ok ( )
146
146
. map ( |boxed| * boxed)
0 commit comments