From 1eb140881b26328ed1b17615fee32427baafadf6 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Thu, 1 Oct 2020 14:45:50 +0200 Subject: Run cargo-fmt Signed-off-by: Matthias Beyer --- src/path/mod.rs | 43 ++++++++++++++++++------------------------- 1 file changed, 18 insertions(+), 25 deletions(-) (limited to 'src/path/mod.rs') diff --git a/src/path/mod.rs b/src/path/mod.rs index 3916010..ac28400 100644 --- a/src/path/mod.rs +++ b/src/path/mod.rs @@ -151,34 +151,30 @@ impl Expression { _ => None, }, - Expression::Subscript(ref expr, index) => { - match expr.get_mut_forcibly(root) { - Some(value) => { - match value.kind { - ValueKind::Array(_) => (), - _ => *value = Vec::::new().into(), - } - - match value.kind { - ValueKind::Array(ref mut array) => { - let index = sindex_to_uindex(index, array.len()); + Expression::Subscript(ref expr, index) => match expr.get_mut_forcibly(root) { + Some(value) => { + match value.kind { + ValueKind::Array(_) => (), + _ => *value = Vec::::new().into(), + } - if index >= array.len() { - array.resize( - (index + 1) as usize, - Value::new(None, ValueKind::Nil), - ); - } + match value.kind { + ValueKind::Array(ref mut array) => { + let index = sindex_to_uindex(index, array.len()); - Some(&mut array[index]) + if index >= array.len() { + array + .resize((index + 1) as usize, Value::new(None, ValueKind::Nil)); } - _ => None, + Some(&mut array[index]) } + + _ => None, } - _ => None, } - } + _ => None, + }, } } @@ -246,10 +242,7 @@ impl Expression { 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.resize((uindex + 1) as usize, Value::new(None, ValueKind::Nil)); } array[uindex] = value; -- cgit v1.2.3