@@ -44,21 +44,15 @@ where
44
44
}
45
45
46
46
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)
62
56
} ,
63
57
)
64
58
}
@@ -357,7 +351,7 @@ impl<A> From<bool> for JsonLikeHelper<A>
357
351
where
358
352
A : for < ' a > JsonLike < ' a > + std:: fmt:: Display + std:: clone:: Clone + std:: cmp:: PartialEq + ' static ,
359
353
{
360
- fn from ( value : bool ) -> Self {
354
+ fn from ( _value : bool ) -> Self {
361
355
todo ! ( )
362
356
}
363
357
}
@@ -366,7 +360,7 @@ impl<A> From<isize> for JsonLikeHelper<A>
366
360
where
367
361
A : for < ' a > JsonLike < ' a > + std:: fmt:: Display + std:: clone:: Clone + std:: cmp:: PartialEq + ' static ,
368
362
{
369
- fn from ( value : isize ) -> Self {
363
+ fn from ( _value : isize ) -> Self {
370
364
todo ! ( )
371
365
}
372
366
}
@@ -384,7 +378,7 @@ impl<A> FromIterator<Self> for JsonLikeHelper<A>
384
378
where
385
379
A : for < ' a > JsonLike < ' a > + std:: fmt:: Display + std:: clone:: Clone + std:: cmp:: PartialEq + ' static ,
386
380
{
387
- fn from_iter < T : IntoIterator < Item = Self > > ( iter : T ) -> Self {
381
+ fn from_iter < T : IntoIterator < Item = Self > > ( _iter : T ) -> Self {
388
382
todo ! ( )
389
383
}
390
384
}
@@ -430,7 +424,7 @@ where
430
424
A : for < ' a > JsonLike < ' a > + std:: fmt:: Display + std:: clone:: Clone + std:: cmp:: PartialEq + ' static ,
431
425
{
432
426
type Output = ValR < Self > ;
433
- fn sub ( self , rhs : Self ) -> Self :: Output {
427
+ fn sub ( self , _rhs : Self ) -> Self :: Output {
434
428
todo ! ( )
435
429
}
436
430
}
@@ -440,7 +434,7 @@ where
440
434
A : for < ' a > JsonLike < ' a > + std:: fmt:: Display + std:: clone:: Clone + std:: cmp:: PartialEq + ' static ,
441
435
{
442
436
type Output = ValR < Self > ;
443
- fn mul ( self , rhs : Self ) -> Self :: Output {
437
+ fn mul ( self , _rhs : Self ) -> Self :: Output {
444
438
todo ! ( )
445
439
}
446
440
}
@@ -450,7 +444,7 @@ where
450
444
A : for < ' a > JsonLike < ' a > + std:: fmt:: Display + std:: clone:: Clone + std:: cmp:: PartialEq + ' static ,
451
445
{
452
446
type Output = ValR < Self > ;
453
- fn div ( self , rhs : Self ) -> Self :: Output {
447
+ fn div ( self , _rhs : Self ) -> Self :: Output {
454
448
todo ! ( )
455
449
}
456
450
}
@@ -460,7 +454,7 @@ where
460
454
A : for < ' a > JsonLike < ' a > + std:: fmt:: Display + std:: clone:: Clone + std:: cmp:: PartialEq + ' static ,
461
455
{
462
456
type Output = ValR < Self > ;
463
- fn rem ( self , rhs : Self ) -> Self :: Output {
457
+ fn rem ( self , _rhs : Self ) -> Self :: Output {
464
458
todo ! ( )
465
459
}
466
460
}
0 commit comments