File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,13 @@ mod system_prefix {
44 use serial_test:: serial;
55 use std:: { ffi:: OsString , path:: PathBuf } ;
66
7+ fn if_exepath ( key : & str , value : impl Into < OsString > ) -> Option < OsString > {
8+ match key {
9+ "EXEPATH" => Some ( value. into ( ) ) ,
10+ _ => None ,
11+ }
12+ }
13+
714 struct ExePath {
815 _tempdir : tempfile:: TempDir ,
916 path : PathBuf ,
@@ -43,10 +50,7 @@ mod system_prefix {
4350 }
4451
4552 fn var_os_func ( & self , key : & str ) -> Option < OsString > {
46- match key {
47- "EXEPATH" => Some ( self . path . clone ( ) . into_os_string ( ) ) ,
48- _ => None ,
49- }
53+ if_exepath ( key, self . path . as_os_str ( ) )
5054 }
5155 }
5256
@@ -113,10 +117,7 @@ mod system_prefix {
113117 let exepath = ExePath :: new ( ) ;
114118 exepath. create_subdir ( name) ;
115119 let _cwd = gix_testtools:: set_current_dir ( & exepath. path ) . expect ( "can change to test dir" ) ;
116- let outcome = system_prefix_from_exepath_var ( |key| match key {
117- "EXEPATH" => Some ( "" . into ( ) ) ,
118- _ => None ,
119- } ) ;
120+ let outcome = system_prefix_from_exepath_var ( |key| if_exepath ( key, "" ) ) ;
120121 assert_eq ! ( outcome, None ) ;
121122 }
122123 }
You can’t perform that action at this time.
0 commit comments