diff options
author | Fredrik Jonsén <fredrikjonsen@gmail.com> | 2017-02-23 00:34:02 +0100 |
---|---|---|
committer | Fredrik Jonsén <fredrikjonsen@gmail.com> | 2017-02-23 00:34:02 +0100 |
commit | caddd562da620505632cdb0168271b2f074e2989 (patch) | |
tree | dfa652afb05ba4d6304def8d8b8b029d7f6d9f58 | |
parent | c9ee1568fe212e4c352ec1afc52db44b34348fcd (diff) |
Fixed bug where get_array would consume self
-rw-r--r-- | src/config.rs | 4 |
1 files changed, 3 insertions, 1 deletions
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<Vec<Value>> { + pub fn get_array(&self, key: &str) -> Option<Vec<Value>> { 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)); |