@@ -105,7 +105,8 @@ impl Accuracy {
105105 . config
106106 . iter ( )
107107 . map ( |c| {
108- simulation_config_from_str ( c) . expect ( & format ! ( "not a valid configuration: {}" , c) )
108+ simulation_config_from_str ( c)
109+ . unwrap_or_else ( |_| panic ! ( "not a valid configuration: {}" , c) )
109110 } )
110111 . collect_vec ( ) ;
111112 let set_sizes = if self . set_size . is_empty ( ) {
@@ -118,9 +119,10 @@ impl Accuracy {
118119
119120 let mut output = self . output ;
120121 output. set_extension ( "csv" ) ;
121- let f = File :: create ( & output) . expect ( & format ! ( "cannot create file: {}" , output. display( ) ) ) ;
122+ let f = File :: create ( & output)
123+ . unwrap_or_else ( |_| panic ! ( "cannot create file: {}" , output. display( ) ) ) ;
122124 write_simulation_results ( & configs, & set_sizes, results, f)
123- . expect ( & format ! ( "cannot write file: {}" , output. display( ) ) ) ;
125+ . unwrap_or_else ( |_| panic ! ( "cannot write file: {}" , output. display( ) ) ) ;
124126 println ! ( " csv file = {}" , output. display( ) ) ;
125127 println ! ( ) ;
126128 }
@@ -139,9 +141,9 @@ impl SimulationConfigParser {
139141 Self ( Regex :: new ( re) . expect ( "" ) , Arc :: new ( f) )
140142 }
141143
142- fn parse < ' a > ( & self , name : & str ) -> Option < SimulationConfig > {
144+ fn parse ( & self , name : & str ) -> Option < SimulationConfig > {
143145 self . 0
144- . captures ( & name)
146+ . captures ( name)
145147 . map ( self . 1 . as_ref ( ) )
146148 . map ( |p| ( name. to_string ( ) , p) )
147149 }
@@ -225,7 +227,11 @@ fn simulation_config_from_str(name: &str) -> Result<SimulationConfig, String> {
225227fn capture_usizes < const N : usize > ( c : & Captures , is : [ usize ; N ] ) -> [ usize ; N ] {
226228 let mut values = [ 0 ; N ] ;
227229 for i in 0 ..is. len ( ) {
228- values[ i] = usize:: from_str_radix ( c. get ( is[ i] ) . expect ( "capture to exist" ) . as_str ( ) , 10 )
230+ values[ i] = c
231+ . get ( is[ i] )
232+ . expect ( "capture to exist" )
233+ . as_str ( )
234+ . parse :: < usize > ( )
229235 . expect ( "number string" ) ;
230236 }
231237 values
0 commit comments