Fix linting warnings
This commit is contained in:
parent
26de0b5c46
commit
5fe1fd0227
2 changed files with 19 additions and 16 deletions
|
@ -38,21 +38,21 @@ impl<'js> FromJs<'js> for Value {
|
||||||
// Extract the value as an object
|
// Extract the value as an object
|
||||||
let v = val.into_object().unwrap();
|
let v = val.into_object().unwrap();
|
||||||
// Check to see if this object is a duration
|
// Check to see if this object is a duration
|
||||||
if (&v).instance_of::<classes::duration::duration::Duration>() {
|
if (v).instance_of::<classes::duration::duration::Duration>() {
|
||||||
let v = v.into_instance::<classes::duration::duration::Duration>().unwrap();
|
let v = v.into_instance::<classes::duration::duration::Duration>().unwrap();
|
||||||
let v: &classes::duration::duration::Duration = v.as_ref();
|
let v: &classes::duration::duration::Duration = v.as_ref();
|
||||||
let v = v.value.clone();
|
let v = v.value.clone();
|
||||||
return Ok(Duration::from(v).into());
|
return Ok(Duration::from(v).into());
|
||||||
}
|
}
|
||||||
// Check to see if this object is a record
|
// Check to see if this object is a record
|
||||||
if (&v).instance_of::<classes::record::record::Record>() {
|
if (v).instance_of::<classes::record::record::Record>() {
|
||||||
let v = v.into_instance::<classes::record::record::Record>().unwrap();
|
let v = v.into_instance::<classes::record::record::Record>().unwrap();
|
||||||
let v: &classes::record::record::Record = v.as_ref();
|
let v: &classes::record::record::Record = v.as_ref();
|
||||||
let v = (v.tb.clone(), v.id.clone());
|
let v = (v.tb.clone(), v.id.clone());
|
||||||
return Ok(Thing::from(v).into());
|
return Ok(Thing::from(v).into());
|
||||||
}
|
}
|
||||||
// Check to see if this object is a uuid
|
// Check to see if this object is a uuid
|
||||||
if (&v).instance_of::<classes::uuid::uuid::Uuid>() {
|
if (v).instance_of::<classes::uuid::uuid::Uuid>() {
|
||||||
let v = v.into_instance::<classes::uuid::uuid::Uuid>().unwrap();
|
let v = v.into_instance::<classes::uuid::uuid::Uuid>().unwrap();
|
||||||
let v: &classes::uuid::uuid::Uuid = v.as_ref();
|
let v: &classes::uuid::uuid::Uuid = v.as_ref();
|
||||||
let v = v.value.clone();
|
let v = v.value.clone();
|
||||||
|
@ -60,7 +60,7 @@ impl<'js> FromJs<'js> for Value {
|
||||||
}
|
}
|
||||||
// Check to see if this object is a date
|
// Check to see if this object is a date
|
||||||
let date: js::Object = ctx.globals().get("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 f: js::Function = v.get("getTime")?;
|
||||||
let m: i64 = f.call((js::This(v),))?;
|
let m: i64 = f.call((js::This(v),))?;
|
||||||
let d = Utc.timestamp_millis(m);
|
let d = Utc.timestamp_millis(m);
|
||||||
|
|
|
@ -41,18 +41,21 @@ impl Value {
|
||||||
let path = path.next();
|
let path = path.next();
|
||||||
v.iter_mut().for_each(|v| v.put(path, val.clone()));
|
v.iter_mut().for_each(|v| v.put(path, val.clone()));
|
||||||
}
|
}
|
||||||
Part::First => match v.first_mut() {
|
Part::First => {
|
||||||
Some(v) => v.put(path.next(), val),
|
if let Some(v) = v.first_mut() {
|
||||||
None => (),
|
v.put(path.next(), val)
|
||||||
},
|
}
|
||||||
Part::Last => match v.last_mut() {
|
}
|
||||||
Some(v) => v.put(path.next(), val),
|
Part::Last => {
|
||||||
None => (),
|
if let Some(v) = v.last_mut() {
|
||||||
},
|
v.put(path.next(), val)
|
||||||
Part::Index(i) => match v.get_mut(i.to_usize()) {
|
}
|
||||||
Some(v) => v.put(path.next(), val),
|
}
|
||||||
None => (),
|
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()));
|
v.iter_mut().for_each(|v| v.put(path, val.clone()));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue