@@ -7,10 +7,10 @@ use tempfile::Builder;
77struct DoNothingFormatter ;
88
99impl CodeFormatter for DoNothingFormatter {
10- fn format_code < ' a > (
10+ fn format_code < T : AsRef < str > > (
1111 & self ,
12- _code : & ' a str ,
13- _config : & Option < Vec < String > > ,
12+ _code : & str ,
13+ _config : Option < & [ T ] > ,
1414 ) -> Result < String , CheckDiffError > {
1515 Ok ( String :: new ( ) )
1616 }
@@ -20,10 +20,10 @@ impl CodeFormatter for DoNothingFormatter {
2020struct AddWhiteSpaceFormatter ;
2121
2222impl CodeFormatter for AddWhiteSpaceFormatter {
23- fn format_code < ' a > (
23+ fn format_code < T : AsRef < str > > (
2424 & self ,
25- code : & ' a str ,
26- _config : & Option < Vec < String > > ,
25+ code : & str ,
26+ _config : Option < & [ T ] > ,
2727 ) -> Result < String , CheckDiffError > {
2828 let result = code. to_string ( ) + " " ;
2929 Ok ( result)
@@ -77,8 +77,9 @@ fn check_diff_test_no_formatting_difference() -> Result<(), CheckDiffError> {
7777 let dir = Builder :: new ( ) . tempdir_in ( "" ) . unwrap ( ) ;
7878 let file_path = dir. path ( ) . join ( "test.rs" ) ;
7979 let _tmp_file = File :: create ( file_path) ?;
80+ let repo_name = "https://github.com/rust-lang/rustfmt.git" ;
8081
81- let errors = check_diff ( None , runners, dir. path ( ) ) ;
82+ let errors = check_diff ( None :: < & [ & str ] > , & runners, dir. path ( ) , repo_name ) ;
8283 assert_eq ! ( errors, 0 ) ;
8384 Ok ( ( ) )
8485}
@@ -89,8 +90,9 @@ fn check_diff_test_formatting_difference() -> Result<(), CheckDiffError> {
8990 let dir = Builder :: new ( ) . tempdir_in ( "" ) . unwrap ( ) ;
9091 let file_path = dir. path ( ) . join ( "test.rs" ) ;
9192 let _tmp_file = File :: create ( file_path) ?;
93+ let repo_name = "https://github.com/rust-lang/rustfmt.git" ;
9294
93- let errors = check_diff ( None , runners, dir. path ( ) ) ;
95+ let errors = check_diff ( None :: < & [ & str ] > , & runners, dir. path ( ) , repo_name ) ;
9496 assert_ne ! ( errors, 0 ) ;
9597 Ok ( ( ) )
9698}
0 commit comments