From 41a33ba66f42d36f8a326fc81469b1ea8f42c0c6 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Wed, 12 Feb 2020 09:12:00 -0500 Subject: [PATCH] Use the magic of the 'From' trait --- src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 4a3b3b5..05f44c9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -296,7 +296,7 @@ impl JSON { // Move to the next character: '}' self.increment(1); - Ok(Some(JSONValue::Object(result))) + Ok(Some(JSONValue::from(result))) } /// See if there's a `JSONValue::Array` next in the JSON @@ -325,7 +325,7 @@ impl JSON { // move to next character: ']' self.increment(1); - Ok(Some(JSONValue::Array(result))) + Ok(Some(JSONValue::from(result))) } /// See if there's a `JSONValue::String` next in the JSON @@ -385,7 +385,7 @@ impl JSON { self.eat('"')?; - Ok(Some(JSONValue::String(result))) + Ok(Some(JSONValue::from(result))) } /// See if there's a `JSONValue::Number` next in the JSON