From caddd562da620505632cdb0168271b2f074e2989 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Jons=C3=A9n?= Date: Thu, 23 Feb 2017 00:34:02 +0100 Subject: Fixed bug where get_array would consume self --- src/config.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/config.rs b/src/config.rs index ad4cda2..ffe341a 100644 --- a/src/config.rs +++ b/src/config.rs @@ -392,7 +392,7 @@ impl Config { self.get(key).and_then(Value::into_table) } - pub fn get_array(self, key: &str) -> Option> { + pub fn get_array(&self, key: &str) -> Option> { self.get(key).and_then(Value::into_array) } } @@ -560,6 +560,7 @@ mod test { .unwrap(); let values = c.get_array("values").unwrap(); + let _values = c.get_array("values").unwrap(); assert_eq!(values.len(), 3); assert_eq!(values[1].clone().into_int(), Some(325)); @@ -573,6 +574,7 @@ mod test { .unwrap(); let values = c.get_array("values").unwrap(); + let _values = c.get_array("values").unwrap(); assert_eq!(values.len(), 3); assert_eq!(values[1].clone().into_int(), Some(325)); -- cgit v1.2.3