@@ -82,9 +82,9 @@ impl Regress {
8282 return true ;
8383 }
8484
85- let sql = manifest_path_to_sql_tests_path ( & manifest_path) ;
85+ let sql = manifest_path_to_sql_tests_path ( manifest_path) ;
8686 if !sql. exists ( ) { return false ; }
87- let expected = manifest_path_to_expected_tests_output_path ( & manifest_path) ;
87+ let expected = manifest_path_to_expected_tests_output_path ( manifest_path) ;
8888 if !expected. exists ( ) { return false ; }
8989
9090 let setup_sql = sql. join ( "setup.sql" ) ;
@@ -164,12 +164,10 @@ impl Regress {
164164
165165 // `setup.{only}` is a special file that we handle separately
166166 let is_setup = |entry : & DirEntry | {
167- if let Some ( filename) = entry. file_name ( ) . to_str ( ) {
168- if filename. ends_with ( & format ! ( "setup.{only}" ) ) {
169- return true ;
170- }
171- }
172- false
167+ entry
168+ . file_name ( )
169+ . to_str ( )
170+ . is_some_and ( |filename| filename. ends_with ( & format ! ( "setup.{only}" ) ) )
173171 } ;
174172
175173 // remove the "setup" file from the list
@@ -179,10 +177,10 @@ impl Regress {
179177 files. sort_unstable_by_key ( |entry| entry. file_name ( ) ) ;
180178
181179 // if we detected a setup file and the caller wants to include it, make it the first entry
182- if let Some ( setup_entry) = setup_entry {
183- if include_setup {
184- files . insert ( 0 , setup_entry ) ;
185- }
180+ if let Some ( setup_entry) = setup_entry
181+ && include_setup
182+ {
183+ files . insert ( 0 , setup_entry ) ;
186184 }
187185 }
188186
@@ -201,7 +199,7 @@ impl Regress {
201199 . to_str ( )
202200 . expect ( "test result output filename should be valid UTF8" )
203201 . to_string ( ) ;
204- let test_output = std:: fs:: read_to_string ( & test_result_output) ?;
202+ let test_output = std:: fs:: read_to_string ( test_result_output) ?;
205203
206204 let variant_suffix: Option < String > ;
207205
@@ -289,12 +287,12 @@ impl Regress {
289287 for new_test in new_tests {
290288 if let Some ( test_result_output) = create_regress_output (
291289 pg_config,
292- & manifest_path,
293- & pgregress_path,
290+ manifest_path,
291+ pgregress_path,
294292 dbname,
295293 new_test,
296294 ) ? {
297- self . accept_new_test ( & manifest_path, & test_result_output, auto) ?;
295+ self . accept_new_test ( manifest_path, & test_result_output, auto) ?;
298296 }
299297 }
300298 }
@@ -304,14 +302,14 @@ impl Regress {
304302
305303 if !success && auto {
306304 // tests failed, but the user asked to `auto`matically accept their output as new output
307- let results_files = self . list_results_outputs ( & manifest_path, include_setup) ?;
305+ let results_files = self . list_results_outputs ( manifest_path, include_setup) ?;
308306
309307 println ! ( ) ;
310308 for entry in results_files {
311309 let filename =
312310 entry. file_name ( ) . to_str ( ) . expect ( "filename should be valid UTF8" ) . to_owned ( ) ;
313311 let expected_path =
314- manifest_path_to_expected_tests_output_path ( & manifest_path) . join ( filename) ;
312+ manifest_path_to_expected_tests_output_path ( manifest_path) . join ( filename) ;
315313
316314 if !expected_path. exists ( ) {
317315 // this is a file from `results/test-name.out` for which we don't have an expected file
@@ -455,7 +453,7 @@ fn create_regress_output(
455453 // doesn't exist, since we are creating the test output. So if that's the case, if we have
456454 // a `.out` file for it in the results/ directory, then we're successful
457455 let out_file =
458- manifest_path_to_results_output_path ( & manifest_path) . join ( format ! ( "{test_name}.out" ) ) ;
456+ manifest_path_to_results_output_path ( manifest_path) . join ( format ! ( "{test_name}.out" ) ) ;
459457 if out_file. exists ( ) {
460458 return Ok ( Some ( out_file) ) ;
461459 } else {
@@ -668,10 +666,11 @@ fn manifest_path_to_results_output_path(manifest_path: &Path) -> PathBuf {
668666}
669667
670668fn add_to_git ( path : & Path ) -> eyre:: Result < ( ) > {
671- if let Ok ( git) = which:: which ( "git" ) {
672- if is_git_repo ( & git) && !Command :: new ( git) . arg ( "add" ) . arg ( path) . status ( ) ?. success ( ) {
673- panic ! ( "unable to add {} to git" , path. display( ) ) ;
674- }
669+ if let Ok ( git) = which:: which ( "git" )
670+ && is_git_repo ( & git)
671+ && !Command :: new ( git) . arg ( "add" ) . arg ( path) . status ( ) ?. success ( )
672+ {
673+ panic ! ( "unable to add {} to git" , path. display( ) ) ;
675674 }
676675 Ok ( ( ) )
677676}
0 commit comments