@@ -19,6 +19,8 @@ trace_macros!(true);
19
19
#[ macro_use]
20
20
mod macros;
21
21
22
+ #[ cfg( feature = "raw_value" ) ]
23
+ use ref_cast:: RefCast ;
22
24
use serde:: de:: { self , IgnoredAny , IntoDeserializer } ;
23
25
use serde:: ser:: { self , SerializeMap , SerializeSeq , Serializer } ;
24
26
use serde:: { Deserialize , Serialize } ;
@@ -31,6 +33,8 @@ use serde_json::{
31
33
} ;
32
34
use std:: collections:: hash_map:: DefaultHasher ;
33
35
use std:: collections:: BTreeMap ;
36
+ #[ cfg( feature = "raw_value" ) ]
37
+ use std:: collections:: HashMap ;
34
38
use std:: fmt:: { self , Debug } ;
35
39
use std:: hash:: { Hash , Hasher } ;
36
40
use std:: io;
@@ -2196,8 +2200,6 @@ fn test_borrowed_raw_value() {
2196
2200
#[ cfg( feature = "raw_value" ) ]
2197
2201
#[ test]
2198
2202
fn test_raw_value_in_map_key ( ) {
2199
- use ref_cast:: RefCast ;
2200
-
2201
2203
#[ derive( RefCast ) ]
2202
2204
#[ repr( transparent) ]
2203
2205
struct RawMapKey ( RawValue ) ;
@@ -2226,7 +2228,7 @@ fn test_raw_value_in_map_key() {
2226
2228
}
2227
2229
}
2228
2230
2229
- let map_from_str: std :: collections :: HashMap < & RawMapKey , & RawValue > =
2231
+ let map_from_str: HashMap < & RawMapKey , & RawValue > =
2230
2232
serde_json:: from_str ( r#" {"\\k":"\\v"} "# ) . unwrap ( ) ;
2231
2233
let ( map_k, map_v) = map_from_str. into_iter ( ) . next ( ) . unwrap ( ) ;
2232
2234
assert_eq ! ( "\" \\ \\ k\" " , map_k. 0 . get( ) ) ;
0 commit comments