Skip to content

Commit

Permalink
Move raw_value test imports to block of imports
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jan 22, 2022
1 parent cbb0342 commit 2d81cbd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/test.rs
Expand Up @@ -19,6 +19,8 @@ trace_macros!(true);
#[macro_use]
mod macros;

#[cfg(feature = "raw_value")]
use ref_cast::RefCast;
use serde::de::{self, IgnoredAny, IntoDeserializer};
use serde::ser::{self, SerializeMap, SerializeSeq, Serializer};
use serde::{Deserialize, Serialize};
Expand All @@ -31,6 +33,8 @@ use serde_json::{
};
use std::collections::hash_map::DefaultHasher;
use std::collections::BTreeMap;
#[cfg(feature = "raw_value")]
use std::collections::HashMap;
use std::fmt::{self, Debug};
use std::hash::{Hash, Hasher};
use std::io;
Expand Down Expand Up @@ -2196,8 +2200,6 @@ fn test_borrowed_raw_value() {
#[cfg(feature = "raw_value")]
#[test]
fn test_raw_value_in_map_key() {
use ref_cast::RefCast;

#[derive(RefCast)]
#[repr(transparent)]
struct RawMapKey(RawValue);
Expand Down Expand Up @@ -2226,7 +2228,7 @@ fn test_raw_value_in_map_key() {
}
}

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

0 comments on commit 2d81cbd

Please sign in to comment.