File tree Expand file tree Collapse file tree 1 file changed +7
-20
lines changed
src/distributions/weighted Expand file tree Collapse file tree 1 file changed +7
-20
lines changed Original file line number Diff line number Diff line change @@ -364,29 +364,16 @@ pub enum WeightedError {
364
364
TooMany ,
365
365
}
366
366
367
- impl WeightedError {
368
- fn msg ( & self ) -> & str {
369
- match * self {
370
- WeightedError :: NoItem => "No weights provided." ,
371
- WeightedError :: InvalidWeight => "A weight is invalid." ,
372
- WeightedError :: AllWeightsZero => "All weights are zero." ,
373
- WeightedError :: TooMany => "Too many weights (hit u32::MAX)" ,
374
- }
375
- }
376
- }
377
-
378
367
#[ cfg( feature="std" ) ]
379
- impl :: std:: error:: Error for WeightedError {
380
- fn description ( & self ) -> & str {
381
- self . msg ( )
382
- }
383
- fn cause ( & self ) -> Option < & dyn ( :: std:: error:: Error ) > {
384
- None
385
- }
386
- }
368
+ impl :: std:: error:: Error for WeightedError { }
387
369
388
370
impl fmt:: Display for WeightedError {
389
371
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
390
- write ! ( f, "{}" , self . msg( ) )
372
+ match * self {
373
+ WeightedError :: NoItem => write ! ( f, "No weights provided." ) ,
374
+ WeightedError :: InvalidWeight => write ! ( f, "A weight is invalid." ) ,
375
+ WeightedError :: AllWeightsZero => write ! ( f, "All weights are zero." ) ,
376
+ WeightedError :: TooMany => write ! ( f, "Too many weights (hit u32::MAX)" ) ,
377
+ }
391
378
}
392
379
}
You can’t perform that action at this time.
0 commit comments