diff --git a/lib/src/fnc/script/from.rs b/lib/src/fnc/script/from.rs index 073d5a7c..c1d69a6d 100644 --- a/lib/src/fnc/script/from.rs +++ b/lib/src/fnc/script/from.rs @@ -38,21 +38,21 @@ impl<'js> FromJs<'js> for Value { // Extract the value as an object let v = val.into_object().unwrap(); // Check to see if this object is a duration - if (&v).instance_of::() { + if (v).instance_of::() { let v = v.into_instance::().unwrap(); let v: &classes::duration::duration::Duration = v.as_ref(); let v = v.value.clone(); return Ok(Duration::from(v).into()); } // Check to see if this object is a record - if (&v).instance_of::() { + if (v).instance_of::() { let v = v.into_instance::().unwrap(); let v: &classes::record::record::Record = v.as_ref(); let v = (v.tb.clone(), v.id.clone()); return Ok(Thing::from(v).into()); } // Check to see if this object is a uuid - if (&v).instance_of::() { + if (v).instance_of::() { let v = v.into_instance::().unwrap(); let v: &classes::uuid::uuid::Uuid = v.as_ref(); let v = v.value.clone(); @@ -60,7 +60,7 @@ impl<'js> FromJs<'js> for Value { } // Check to see if this object is a date let date: js::Object = ctx.globals().get("Date")?; - if (&v).is_instance_of(&date) { + if (v).is_instance_of(&date) { let f: js::Function = v.get("getTime")?; let m: i64 = f.call((js::This(v),))?; let d = Utc.timestamp_millis(m); diff --git a/lib/src/sql/value/put.rs b/lib/src/sql/value/put.rs index 52dd400a..b110d5b5 100644 --- a/lib/src/sql/value/put.rs +++ b/lib/src/sql/value/put.rs @@ -41,18 +41,21 @@ impl Value { let path = path.next(); v.iter_mut().for_each(|v| v.put(path, val.clone())); } - Part::First => match v.first_mut() { - Some(v) => v.put(path.next(), val), - None => (), - }, - Part::Last => match v.last_mut() { - Some(v) => v.put(path.next(), val), - None => (), - }, - Part::Index(i) => match v.get_mut(i.to_usize()) { - Some(v) => v.put(path.next(), val), - None => (), - }, + Part::First => { + if let Some(v) = v.first_mut() { + v.put(path.next(), val) + } + } + Part::Last => { + if let Some(v) = v.last_mut() { + v.put(path.next(), val) + } + } + Part::Index(i) => { + if let Some(v) = v.get_mut(i.to_usize()) { + v.put(path.next(), val) + } + } _ => { v.iter_mut().for_each(|v| v.put(path, val.clone())); }