Skip to content

Commit 84901ed

Browse files
committed
style fixes
1 parent ed63818 commit 84901ed

File tree

1 file changed

+16
-22
lines changed
  • tailcall-template/src/jq

1 file changed

+16
-22
lines changed

tailcall-template/src/jq/jq.rs

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,15 @@ where
4444
}
4545

4646
fn from_map<I: IntoIterator<Item = (Self, Self)>>(iter: I) -> ValR<Self> {
47-
iter.into_iter().fold(
48-
ValR::Ok(Self(JsonLike::object(JsonObjectLike::new()))),
49-
|acc, (key, value)| {
50-
let Some(key) = JsonLike::as_str(&key.0) else {
51-
return ValR::Err(jaq_core::Error::str("Key cannot be converted to String"));
52-
};
53-
54-
match acc {
55-
Ok(mut acc) => {
56-
let acc_mut = JsonLike::as_object_mut(&mut acc.0).unwrap();
57-
acc_mut.insert_key(key, value.0);
58-
ValR::Ok(acc)
59-
}
60-
Err(err) => ValR::Err(err),
61-
}
47+
iter.into_iter().try_fold(
48+
Self(JsonLike::object(JsonObjectLike::new())),
49+
|mut acc, (key, value)| {
50+
let key = JsonLike::as_str(&key.0)
51+
.ok_or_else(|| jaq_core::Error::str("Key cannot be converted to String"))?;
52+
JsonLike::as_object_mut(&mut acc.0)
53+
.unwrap()
54+
.insert_key(key, value.0);
55+
Ok(acc)
6256
},
6357
)
6458
}
@@ -357,7 +351,7 @@ impl<A> From<bool> for JsonLikeHelper<A>
357351
where
358352
A: for<'a> JsonLike<'a> + std::fmt::Display + std::clone::Clone + std::cmp::PartialEq + 'static,
359353
{
360-
fn from(value: bool) -> Self {
354+
fn from(_value: bool) -> Self {
361355
todo!()
362356
}
363357
}
@@ -366,7 +360,7 @@ impl<A> From<isize> for JsonLikeHelper<A>
366360
where
367361
A: for<'a> JsonLike<'a> + std::fmt::Display + std::clone::Clone + std::cmp::PartialEq + 'static,
368362
{
369-
fn from(value: isize) -> Self {
363+
fn from(_value: isize) -> Self {
370364
todo!()
371365
}
372366
}
@@ -384,7 +378,7 @@ impl<A> FromIterator<Self> for JsonLikeHelper<A>
384378
where
385379
A: for<'a> JsonLike<'a> + std::fmt::Display + std::clone::Clone + std::cmp::PartialEq + 'static,
386380
{
387-
fn from_iter<T: IntoIterator<Item = Self>>(iter: T) -> Self {
381+
fn from_iter<T: IntoIterator<Item = Self>>(_iter: T) -> Self {
388382
todo!()
389383
}
390384
}
@@ -430,7 +424,7 @@ where
430424
A: for<'a> JsonLike<'a> + std::fmt::Display + std::clone::Clone + std::cmp::PartialEq + 'static,
431425
{
432426
type Output = ValR<Self>;
433-
fn sub(self, rhs: Self) -> Self::Output {
427+
fn sub(self, _rhs: Self) -> Self::Output {
434428
todo!()
435429
}
436430
}
@@ -440,7 +434,7 @@ where
440434
A: for<'a> JsonLike<'a> + std::fmt::Display + std::clone::Clone + std::cmp::PartialEq + 'static,
441435
{
442436
type Output = ValR<Self>;
443-
fn mul(self, rhs: Self) -> Self::Output {
437+
fn mul(self, _rhs: Self) -> Self::Output {
444438
todo!()
445439
}
446440
}
@@ -450,7 +444,7 @@ where
450444
A: for<'a> JsonLike<'a> + std::fmt::Display + std::clone::Clone + std::cmp::PartialEq + 'static,
451445
{
452446
type Output = ValR<Self>;
453-
fn div(self, rhs: Self) -> Self::Output {
447+
fn div(self, _rhs: Self) -> Self::Output {
454448
todo!()
455449
}
456450
}
@@ -460,7 +454,7 @@ where
460454
A: for<'a> JsonLike<'a> + std::fmt::Display + std::clone::Clone + std::cmp::PartialEq + 'static,
461455
{
462456
type Output = ValR<Self>;
463-
fn rem(self, rhs: Self) -> Self::Output {
457+
fn rem(self, _rhs: Self) -> Self::Output {
464458
todo!()
465459
}
466460
}

0 commit comments

Comments
 (0)