summaryrefslogtreecommitdiffstats
path: root/src/path/mod.rs
diff options
context:
space:
mode:
authorJoel Gallant <joel@joelgallant.me>2020-09-03 12:06:08 -0600
committerGitHub <noreply@github.com>2020-09-03 12:06:08 -0600
commit436c964037a1833fe6d17eda37e25425af7e9760 (patch)
tree5e6468c43f2f06fca2a338839a3d7a80e4d67d49 /src/path/mod.rs
parent2c0b201055be60ec45e258adcc6c4b6e01bcd627 (diff)
parente84a39949c0c1625c1886b8f718b8165c7a8e831 (diff)
Merge pull request #134 from eisterman/fix_clippy_warnings
Fix of all the clippy warnings and removing of deprecated Error::description method
Diffstat (limited to 'src/path/mod.rs')
-rw-r--r--src/path/mod.rs23
1 files changed, 9 insertions, 14 deletions
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::<Value>::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;
}
}
}