@@ -3,9 +3,7 @@ use std::collections::HashMap;
3
3
use std:: hash:: { BuildHasherDefault , Hasher } ;
4
4
use std:: fmt;
5
5
6
- // `Box<Any>` is now `Box<dyn Any>`, but we can't change yet (minimum Rust)
7
- #[ allow( warnings) ]
8
- type AnyMap = HashMap < TypeId , Box < Any + Send + Sync > , BuildHasherDefault < IdHasher > > ;
6
+ type AnyMap = HashMap < TypeId , Box < dyn Any + Send + Sync > , BuildHasherDefault < IdHasher > > ;
9
7
10
8
// With TypeIds as keys, there's no need to hash them. They are already hashes
11
9
// themselves, coming from the compiler. The IdHasher just holds the u64 of
@@ -71,9 +69,7 @@ impl Extensions {
71
69
. get_or_insert_with ( || Box :: new ( HashMap :: default ( ) ) )
72
70
. insert ( TypeId :: of :: < T > ( ) , Box :: new ( val) )
73
71
. and_then ( |boxed| {
74
- #[ allow( warnings) ]
75
- {
76
- ( boxed as Box < Any + ' static > )
72
+ ( boxed as Box < dyn Any + ' static > )
77
73
. downcast ( )
78
74
. ok ( )
79
75
. map ( |boxed| * boxed)
@@ -98,12 +94,7 @@ impl Extensions {
98
94
. map
99
95
. as_ref ( )
100
96
. and_then ( |map| map. get ( & TypeId :: of :: < T > ( ) ) )
101
- . and_then ( |boxed| {
102
- #[ allow( warnings) ]
103
- {
104
- ( & * * boxed as & ( Any + ' static ) ) . downcast_ref ( )
105
- }
106
- } )
97
+ . and_then ( |boxed| ( & * * boxed as & ( dyn Any + ' static ) ) . downcast_ref ( ) )
107
98
}
108
99
109
100
/// Get a mutable reference to a type previously inserted on this `Extensions`.
@@ -123,12 +114,7 @@ impl Extensions {
123
114
. map
124
115
. as_mut ( )
125
116
. and_then ( |map| map. get_mut ( & TypeId :: of :: < T > ( ) ) )
126
- . and_then ( |boxed| {
127
- #[ allow( warnings) ]
128
- {
129
- ( & mut * * boxed as & mut ( Any + ' static ) ) . downcast_mut ( )
130
- }
131
- } )
117
+ . and_then ( |boxed| ( & mut * * boxed as & mut ( dyn Any + ' static ) ) . downcast_mut ( ) )
132
118
}
133
119
134
120
@@ -151,9 +137,7 @@ impl Extensions {
151
137
. as_mut ( )
152
138
. and_then ( |map| map. remove ( & TypeId :: of :: < T > ( ) ) )
153
139
. and_then ( |boxed| {
154
- #[ allow( warnings) ]
155
- {
156
- ( boxed as Box < Any + ' static > )
140
+ ( boxed as Box < dyn Any + ' static > )
157
141
. downcast ( )
158
142
. ok ( )
159
143
. map ( |boxed| * boxed)
0 commit comments