Stop taking references when not needed

This commit is contained in:
Daniel Lockyer 2017-03-30 12:42:27 +01:00
parent 3034a7cf52
commit cecb0b58a7
2 changed files with 6 additions and 6 deletions

View file

@ -470,7 +470,7 @@ impl<'a> de::Deserializer for ValueDeserializer<'a> {
where V: de::Visitor, where V: de::Visitor,
{ {
if name == SERDE_STRUCT_NAME && fields == &[SERDE_STRUCT_FIELD_NAME] { if name == SERDE_STRUCT_NAME && fields == &[SERDE_STRUCT_FIELD_NAME] {
if let Value::Datetime(ref s) = self.value { if let Value::Datetime(s) = self.value {
return visitor.visit_map(DatetimeDeserializer { return visitor.visit_map(DatetimeDeserializer {
date: s, date: s,
visited: false, visited: false,
@ -783,7 +783,7 @@ impl<'a> Deserializer<'a> {
if suffix != "" { if suffix != "" {
return Err(self.error(start, ErrorKind::NumberInvalid)) return Err(self.error(start, ErrorKind::NumberInvalid))
} }
let (a, b) = self.parse_integer(&after, false, true)?; let (a, b) = self.parse_integer(after, false, true)?;
fraction = Some(a); fraction = Some(a);
suffix = b; suffix = b;
} }

View file

@ -283,7 +283,7 @@ impl<'a> Serializer<'a> {
if array_of_tables { if array_of_tables {
self.dst.push_str("["); self.dst.push_str("[");
} }
self.emit_key_part(&state)?; self.emit_key_part(state)?;
if array_of_tables { if array_of_tables {
self.dst.push_str("]"); self.dst.push_str("]");
} }
@ -586,10 +586,10 @@ impl<'a, 'b> ser::SerializeMap for SerializeTable<'a, 'b> {
let res = value.serialize(&mut Serializer { let res = value.serialize(&mut Serializer {
dst: &mut *ser.dst, dst: &mut *ser.dst,
state: State::Table { state: State::Table {
key: &key, key: key,
parent: &ser.state, parent: &ser.state,
first: &first, first: first,
table_emitted: &table_emitted, table_emitted: table_emitted,
}, },
}); });
match res { match res {