File tree Expand file tree Collapse file tree 2 files changed +9
-17
lines changed
src/distributions/weighted Expand file tree Collapse file tree 2 files changed +9
-17
lines changed Original file line number Diff line number Diff line change 8
8
9
9
#![ feature( test) ]
10
10
11
+ extern crate test;
12
+
11
13
const RAND_BENCH_N : u64 = 1000 ;
12
14
13
15
use std:: mem:: size_of;
Original file line number Diff line number Diff line change @@ -364,26 +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
- }
368
+ impl :: std:: error:: Error for WeightedError { }
384
369
385
370
impl fmt:: Display for WeightedError {
386
371
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
387
- 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
+ }
388
378
}
389
379
}
You can’t perform that action at this time.
0 commit comments