From cecb0b58a7c9e04e43a2ead47064c574dcb548a8 Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Thu, 30 Mar 2017 12:42:27 +0100 Subject: [PATCH] Stop taking references when not needed --- src/de.rs | 4 ++-- src/ser.rs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/de.rs b/src/de.rs index 0022791..13a3d90 100644 --- a/src/de.rs +++ b/src/de.rs @@ -470,7 +470,7 @@ impl<'a> de::Deserializer for ValueDeserializer<'a> { where V: de::Visitor, { 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 { date: s, visited: false, @@ -783,7 +783,7 @@ impl<'a> Deserializer<'a> { if suffix != "" { 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); suffix = b; } diff --git a/src/ser.rs b/src/ser.rs index bc5f357..8fcf0eb 100644 --- a/src/ser.rs +++ b/src/ser.rs @@ -283,7 +283,7 @@ impl<'a> Serializer<'a> { if array_of_tables { self.dst.push_str("["); } - self.emit_key_part(&state)?; + self.emit_key_part(state)?; if array_of_tables { self.dst.push_str("]"); } @@ -586,10 +586,10 @@ impl<'a, 'b> ser::SerializeMap for SerializeTable<'a, 'b> { let res = value.serialize(&mut Serializer { dst: &mut *ser.dst, state: State::Table { - key: &key, + key: key, parent: &ser.state, - first: &first, - table_emitted: &table_emitted, + first: first, + table_emitted: table_emitted, }, }); match res {