summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Scott <sam.scott89@gmail.com>2017-04-25 11:28:02 +0100
committerSam Scott <sam.scott89@gmail.com>2017-04-25 11:28:02 +0100
commita0737c0e135ab9f3161f65713159e2aefac2dcf0 (patch)
tree884344a4143106e95ade0de0f68de1e90c7e06f1 /src
parent7f4764dd6b63c0c0cf0d27268dfa812c0f2334fc (diff)
Fix errors for primitive deserializing.
Diffstat (limited to 'src')
-rw-r--r--src/de.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/de.rs b/src/de.rs
index 8019975..f0b8614 100644
--- a/src/de.rs
+++ b/src/de.rs
@@ -570,17 +570,16 @@ macro_rules! deserialize_primitive {
where V: de::Visitor<'de>,
{
match self.0 {
- Level::Nested(map) => {
- Deserializer::with_map(map).deserialize_map(visitor)
+ Level::Nested(_) => {
+ Err(de::Error::custom(format!("Expected: {:?}, got a Map",
+ stringify!($ty))))
},
- Level::Sequence(seq) => {
- SeqDeserializer::new(seq.into_iter()).deserialize_any(visitor)
+ Level::Sequence(_) => {
+ Err(de::Error::custom(format!("Expected: {:?}, got a Sequence",
+ stringify!($ty))))
},
Level::Flat(x) => {
visitor.$visit_method(str::FromStr::from_str(&x).unwrap())
- // visitor.visit_u32(str::FromStr::from_str(&x).or_else(|_| {
- // Err(de::Error::custom(format!("Unexpected string: {}", x)))
- // }))
},
Level::Invalid(e) => {
Err(de::Error::custom(e))