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 {
4
4
use serial_test:: serial;
5
5
use std:: { ffi:: OsString , path:: PathBuf } ;
6
6
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
+
7
14
struct ExePath {
8
15
_tempdir : tempfile:: TempDir ,
9
16
path : PathBuf ,
@@ -43,10 +50,7 @@ mod system_prefix {
43
50
}
44
51
45
52
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 ( ) )
50
54
}
51
55
}
52
56
@@ -113,10 +117,7 @@ mod system_prefix {
113
117
let exepath = ExePath :: new ( ) ;
114
118
exepath. create_subdir ( name) ;
115
119
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, "" ) ) ;
120
121
assert_eq ! ( outcome, None ) ;
121
122
}
122
123
}
You can’t perform that action at this time.
0 commit comments