Skip to content

Commit 2d81cbd

Browse files
committed
Move raw_value test imports to block of imports
1 parent cbb0342 commit 2d81cbd

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tests/test.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ trace_macros!(true);
1919
#[macro_use]
2020
mod macros;
2121

22+
#[cfg(feature = "raw_value")]
23+
use ref_cast::RefCast;
2224
use serde::de::{self, IgnoredAny, IntoDeserializer};
2325
use serde::ser::{self, SerializeMap, SerializeSeq, Serializer};
2426
use serde::{Deserialize, Serialize};
@@ -31,6 +33,8 @@ use serde_json::{
3133
};
3234
use std::collections::hash_map::DefaultHasher;
3335
use std::collections::BTreeMap;
36+
#[cfg(feature = "raw_value")]
37+
use std::collections::HashMap;
3438
use std::fmt::{self, Debug};
3539
use std::hash::{Hash, Hasher};
3640
use std::io;
@@ -2196,8 +2200,6 @@ fn test_borrowed_raw_value() {
21962200
#[cfg(feature = "raw_value")]
21972201
#[test]
21982202
fn test_raw_value_in_map_key() {
2199-
use ref_cast::RefCast;
2200-
22012203
#[derive(RefCast)]
22022204
#[repr(transparent)]
22032205
struct RawMapKey(RawValue);
@@ -2226,7 +2228,7 @@ fn test_raw_value_in_map_key() {
22262228
}
22272229
}
22282230

2229-
let map_from_str: std::collections::HashMap<&RawMapKey, &RawValue> =
2231+
let map_from_str: HashMap<&RawMapKey, &RawValue> =
22302232
serde_json::from_str(r#" {"\\k":"\\v"} "#).unwrap();
22312233
let (map_k, map_v) = map_from_str.into_iter().next().unwrap();
22322234
assert_eq!("\"\\\\k\"", map_k.0.get());

0 commit comments

Comments
 (0)