@@ -13,33 +13,7 @@ macro_rules! impl_error_chain_kind {
13
13
items [ ] buf [ ]
14
14
queue [ $( $chunks) * ] ) ;
15
15
} ;
16
- ( $( #[ $meta: meta] ) *
17
- enum $name: ident { $( $chunks: tt) * }
18
- ) => {
19
- impl_error_chain_kind!( SORT [ enum $name $( #[ $meta] ) * ]
20
- items [ ] buf [ ]
21
- queue [ $( $chunks) * ] ) ;
22
- } ;
23
16
// Queue is empty, can do the work
24
- ( SORT [ enum $name: ident $( #[ $meta: meta] ) * ]
25
- items [ $( $( #[ $imeta: meta] ) *
26
- => $iitem: ident: $imode: tt [ $( $ivar: ident: $ityp: ty ) ,* ]
27
- { $( $ifuncs: tt ) * } ) * ]
28
- buf [ ]
29
- queue [ ]
30
- ) => {
31
- impl_error_chain_kind!( ENUM_DEFINITION [ enum $name $( #[ $meta] ) * ]
32
- body [ ]
33
- queue [ $( $( #[ $imeta] ) *
34
- => $iitem: $imode [ $( $ivar: $ityp ) ,* ] ) * ]
35
- ) ;
36
- impl_error_chain_kind!( IMPLEMENTATIONS $name { $(
37
- $iitem: $imode [ $( #[ $imeta] ) * ] [ $( $ivar: $ityp ) ,* ] { $( $ifuncs ) * }
38
- ) * } ) ;
39
- $(
40
- impl_error_chain_kind!( ERROR_CHECK $imode $( $ifuncs) * ) ;
41
- ) *
42
- } ;
43
17
( SORT [ pub enum $name: ident $( #[ $meta: meta] ) * ]
44
18
items [ $( $( #[ $imeta: meta] ) *
45
19
=> $iitem: ident: $imode: tt [ $( $ivar: ident: $ityp: ty ) ,* ]
@@ -206,20 +180,6 @@ macro_rules! impl_error_chain_kind {
206
180
__Nonexhaustive { }
207
181
}
208
182
} ;
209
- // Private enum (Queue Empty)
210
- ( ENUM_DEFINITION [ enum $name: ident $( #[ $meta: meta] ) * ]
211
- body [ $( $( #[ $imeta: meta] ) *
212
- => $iitem: ident ( $( ( $( $ttyp: ty ) ,+) ) * ) { $( { $( $svar: ident: $styp: ty ) ,* } ) * } ) * ]
213
- queue [ ]
214
- ) => {
215
- $( #[ $meta] ) *
216
- enum $name {
217
- $(
218
- $( #[ $imeta] ) *
219
- $iitem $( ( $( $ttyp ) ,* ) ) * $( { $( $svar: $styp ) ,* } ) * ,
220
- ) *
221
- }
222
- } ;
223
183
// Unit variant
224
184
( ENUM_DEFINITION [ $( $def: tt ) * ]
225
185
body [ $( $( #[ $imeta: meta] ) *
@@ -287,35 +247,6 @@ macro_rules! impl_error_chain_kind {
287
247
}
288
248
}
289
249
}
290
- /*#[allow(unused)]
291
- impl ::std::error::Error for $name {
292
- fn description(&self) -> &str {
293
- match *self {
294
- $(
295
- impl_error_chain_kind!(ITEM_PATTERN
296
- $name $item: $imode [$( ref $var ),*]
297
- ) => {
298
- impl_error_chain_kind!(FIND_DESCRIPTION_IMPL
299
- $item: $imode self fmt [$( $var ),*]
300
- {$( $funcs )*})
301
- }
302
- )*
303
- }
304
- }
305
- fn cause(&self) -> Option<&::std::error::Error> {
306
- match *self {
307
- $(
308
- impl_error_chain_kind!(ITEM_PATTERN
309
- $name $item: $imode [$( ref $var ),*]
310
- ) => {
311
- impl_error_chain_kind!(FIND_CAUSE_IMPL
312
- $item: $imode [$( $var ),*]
313
- {$( $funcs )*})
314
- }
315
- )*
316
- }
317
- }
318
- }*/
319
250
#[ allow( unknown_lints, unused, unused_doc_comment) ]
320
251
impl $name {
321
252
/// A string describing the error kind.
@@ -336,11 +267,6 @@ macro_rules! impl_error_chain_kind {
336
267
}
337
268
}
338
269
}
339
- $(
340
- impl_error_chain_kind!( FIND_FROM_IMPL
341
- $name $item: $imode [ $( $var: $typ ) ,* ]
342
- { $( $funcs ) * } ) ;
343
- ) *
344
270
} ;
345
271
( FIND_DISPLAY_IMPL $name: ident $item: ident: $imode: tt
346
272
{ display( $self_: tt) -> ( $( $exprs: tt ) * ) $( $tail: tt ) * }
@@ -393,96 +319,6 @@ macro_rules! impl_error_chain_kind {
393
319
) => {
394
320
stringify!( $item)
395
321
} ;
396
- ( FIND_CAUSE_IMPL $item: ident: $imode: tt
397
- [ $( $var: ident ) ,* ]
398
- { cause( $expr: expr) $( $tail: tt ) * }
399
- ) => {
400
- Some ( $expr)
401
- } ;
402
- ( FIND_CAUSE_IMPL $item: ident: $imode: tt
403
- [ $( $var: ident ) ,* ]
404
- { $t: tt $( $tail: tt ) * }
405
- ) => {
406
- impl_error_chain_kind!( FIND_CAUSE_IMPL
407
- $item: $imode [ $( $var ) ,* ]
408
- { $( $tail) * } )
409
- } ;
410
- ( FIND_CAUSE_IMPL $item: ident: $imode: tt
411
- [ $( $var: ident ) ,* ]
412
- { }
413
- ) => {
414
- None
415
- } ;
416
- ( FIND_FROM_IMPL $name: ident $item: ident: $imode: tt
417
- [ $( $var: ident: $typ: ty ) ,* ]
418
- { from( ) $( $tail: tt ) * }
419
- ) => {
420
- $(
421
- impl From <$typ> for $name {
422
- fn from( $var: $typ) -> $name {
423
- $name:: $item( $var)
424
- }
425
- }
426
- ) *
427
- impl_error_chain_kind!( FIND_FROM_IMPL
428
- $name $item: $imode [ $( $var: $typ ) ,* ]
429
- { $( $tail ) * } ) ;
430
- } ;
431
- ( FIND_FROM_IMPL $name: ident $item: ident: UNIT
432
- [ ]
433
- { from( $ftyp: ty) $( $tail: tt ) * }
434
- ) => {
435
- impl From <$ftyp> for $name {
436
- fn from( _discarded_error: $ftyp) -> $name {
437
- $name:: $item
438
- }
439
- }
440
- impl_error_chain_kind!( FIND_FROM_IMPL
441
- $name $item: UNIT [ ]
442
- { $( $tail ) * } ) ;
443
- } ;
444
- ( FIND_FROM_IMPL $name: ident $item: ident: TUPLE
445
- [ $( $var: ident: $typ: ty ) ,* ]
446
- { from( $fvar: ident: $ftyp: ty) -> ( $( $texpr: expr ) ,* ) $( $tail: tt ) * }
447
- ) => {
448
- impl From <$ftyp> for $name {
449
- fn from( $fvar: $ftyp) -> $name {
450
- $name:: $item( $( $texpr ) ,* )
451
- }
452
- }
453
- impl_error_chain_kind!( FIND_FROM_IMPL
454
- $name $item: TUPLE [ $( $var: $typ ) ,* ]
455
- { $( $tail) * } ) ;
456
- } ;
457
- ( FIND_FROM_IMPL $name: ident $item: ident: STRUCT
458
- [ $( $var: ident: $typ: ty ) ,* ]
459
- { from( $fvar: ident: $ftyp: ty) -> { $( $tvar: ident: $texpr: expr ) ,* } $( $tail: tt ) * }
460
- ) => {
461
- impl From <$ftyp> for $name {
462
- fn from( $fvar: $ftyp) -> $name {
463
- $name:: $item {
464
- $( $tvar: $texpr ) ,*
465
- }
466
- }
467
- }
468
- impl_error_chain_kind!( FIND_FROM_IMPL
469
- $name $item: STRUCT [ $( $var: $typ ) ,* ]
470
- { $( $tail) * } ) ;
471
- } ;
472
- ( FIND_FROM_IMPL $name: ident $item: ident: $imode: tt
473
- [ $( $var: ident: $typ: ty ) ,* ]
474
- { $t: tt $( $tail: tt ) * }
475
- ) => {
476
- impl_error_chain_kind!( FIND_FROM_IMPL
477
- $name $item: $imode [ $( $var: $typ ) ,* ]
478
- { $( $tail ) * }
479
- ) ;
480
- } ;
481
- ( FIND_FROM_IMPL $name: ident $item: ident: $imode: tt
482
- [ $( $var: ident: $typ: ty ) ,* ]
483
- { }
484
- ) => {
485
- } ;
486
322
( ITEM_BODY $( #[ $imeta: meta] ) * $item: ident: UNIT
487
323
) => { } ;
488
324
( ITEM_BODY $( #[ $imeta: meta] ) * $item: ident: TUPLE
@@ -521,16 +357,6 @@ macro_rules! impl_error_chain_kind {
521
357
=> { impl_error_chain_kind!( ERROR_CHECK_COMMA $imode $( $tail) * ) ; } ;
522
358
( ERROR_CHECK $imode: tt description( $expr: expr) $( $tail: tt ) * )
523
359
=> { impl_error_chain_kind!( ERROR_CHECK_COMMA $imode $( $tail) * ) ; } ;
524
- ( ERROR_CHECK $imode: tt cause( $expr: expr) $( $tail: tt) * )
525
- => { impl_error_chain_kind!( ERROR_CHECK_COMMA $imode $( $tail) * ) ; } ;
526
- ( ERROR_CHECK $imode: tt from( ) $( $tail: tt) * )
527
- => { impl_error_chain_kind!( ERROR_CHECK_COMMA $imode $( $tail) * ) ; } ;
528
- ( ERROR_CHECK $imode: tt from( $ftyp: ty) $( $tail: tt) * )
529
- => { impl_error_chain_kind!( ERROR_CHECK_COMMA $imode $( $tail) * ) ; } ;
530
- ( ERROR_CHECK TUPLE from( $fvar: ident: $ftyp: ty) -> ( $( $e: expr ) ,* ) $( $tail: tt ) * )
531
- => { impl_error_chain_kind!( ERROR_CHECK_COMMA TUPLE $( $tail) * ) ; } ;
532
- ( ERROR_CHECK STRUCT from( $fvar: ident: $ftyp: ty) -> { $( $v: ident: $e: expr ) ,* } $( $tail: tt ) * )
533
- => { impl_error_chain_kind!( ERROR_CHECK_COMMA STRUCT $( $tail) * ) ; } ;
534
360
( ERROR_CHECK $imode: tt ) => { } ;
535
361
( ERROR_CHECK_COMMA $imode: tt , $( $tail: tt ) * )
536
362
=> { impl_error_chain_kind!( ERROR_CHECK $imode $( $tail) * ) ; } ;
0 commit comments