summaryrefslogtreecommitdiffstats
path: root/vendor/serde_json/src/de.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/serde_json/src/de.rs')
-rw-r--r--vendor/serde_json/src/de.rs39
1 files changed, 37 insertions, 2 deletions
diff --git a/vendor/serde_json/src/de.rs b/vendor/serde_json/src/de.rs
index 7f3145980..9975b40a5 100644
--- a/vendor/serde_json/src/de.rs
+++ b/vendor/serde_json/src/de.rs
@@ -2203,6 +2203,41 @@ where
deserialize_numeric_key!(deserialize_f32, deserialize_f32);
deserialize_numeric_key!(deserialize_f64);
+ fn deserialize_bool<V>(self, visitor: V) -> Result<V::Value>
+ where
+ V: de::Visitor<'de>,
+ {
+ self.de.eat_char();
+
+ let peek = match tri!(self.de.next_char()) {
+ Some(b) => b,
+ None => {
+ return Err(self.de.peek_error(ErrorCode::EofWhileParsingValue));
+ }
+ };
+
+ let value = match peek {
+ b't' => {
+ tri!(self.de.parse_ident(b"rue\""));
+ visitor.visit_bool(true)
+ }
+ b'f' => {
+ tri!(self.de.parse_ident(b"alse\""));
+ visitor.visit_bool(false)
+ }
+ _ => {
+ self.de.scratch.clear();
+ let s = tri!(self.de.read.parse_str(&mut self.de.scratch));
+ Err(de::Error::invalid_type(Unexpected::Str(&s), &visitor))
+ }
+ };
+
+ match value {
+ Ok(value) => Ok(value),
+ Err(err) => Err(self.de.fix_position(err)),
+ }
+ }
+
#[inline]
fn deserialize_option<V>(self, visitor: V) -> Result<V::Value>
where
@@ -2258,7 +2293,7 @@ where
}
forward_to_deserialize_any! {
- bool char str string unit unit_struct seq tuple tuple_struct map struct
+ char str string unit unit_struct seq tuple tuple_struct map struct
identifier ignored_any
}
}
@@ -2406,7 +2441,7 @@ where
if self_delineated_value {
Ok(value)
} else {
- self.peek_end_of_value().map(|_| value)
+ self.peek_end_of_value().map(|()| value)
}
}
Err(e) => {