From 57fb2610ad274dff1d2f2e4d43dfce05ca9c4835 Mon Sep 17 00:00:00 2001 From: Federico Pasqua Date: Sat, 14 Mar 2020 15:46:36 +0100 Subject: General upgrade for clippy fix and remove of deprecated methods for errors --- src/path/mod.rs | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'src/path') diff --git a/src/path/mod.rs b/src/path/mod.rs index f63deee..3916010 100644 --- a/src/path/mod.rs +++ b/src/path/mod.rs @@ -152,7 +152,6 @@ impl Expression { }, Expression::Subscript(ref expr, index) => { - let mut do_again = false; match expr.get_mut_forcibly(root) { Some(value) => { match value.kind { @@ -183,7 +182,7 @@ impl Expression { } } - pub fn set<'a>(&self, root: &'a mut Value, value: Value) { + pub fn set(&self, root: &mut Value, value: Value) { match *self { Expression::Identifier(ref id) => { // Ensure that root is a table @@ -244,20 +243,16 @@ impl Expression { _ => *parent = Vec::::new().into(), } - match parent.kind { - ValueKind::Array(ref mut array) => { - let uindex = sindex_to_uindex(index, array.len()); - if uindex >= array.len() { - array.resize( - (uindex + 1) as usize, - Value::new(None, ValueKind::Nil), - ); - } - - array[uindex] = value.clone(); + if let ValueKind::Array(ref mut array) = parent.kind { + let uindex = sindex_to_uindex(index, array.len()); + if uindex >= array.len() { + array.resize( + (uindex + 1) as usize, + Value::new(None, ValueKind::Nil), + ); } - _ => (), + array[uindex] = value; } } } -- cgit v1.2.3