@@ -77,14 +77,18 @@ pub fn source_path() -> PathBuf {
7777}
7878
7979/// Creates a new symlink to a path on the filesystem, adjusting for Windows or Unix.
80+ #[ cfg( target_family = "windows" ) ]
8081pub fn create_symlink < P : AsRef < Path > , Q : AsRef < Path > > ( original : P , link : Q ) {
81- if is_windows ( ) {
82- use std:: os:: windows:: fs;
83- fs:: symlink_file ( original, link) . unwrap ( ) ;
84- } else {
85- use std:: os:: unix:: fs;
86- fs:: symlink ( original, link) . unwrap ( ) ;
87- }
82+ use std:: os:: windows:: fs;
83+ fs:: symlink_file ( original, link) . unwrap ( ) ;
84+ }
85+
86+ /// Creates a new symlink to a path on the filesystem, adjusting for Windows or Unix.
87+ #[ cfg( target_family = "unix" ) ]
88+ pub fn create_symlink < P : AsRef < Path > , Q : AsRef < Path > > ( original : P , link : Q ) {
89+ use std:: os:: unix:: fs;
90+ fs:: symlink ( original, link)
91+ . expect ( & format ! ( "failed to create symlink {} for {}" , link, original) ) ;
8892}
8993
9094/// Construct the static library name based on the platform.
@@ -107,12 +111,7 @@ pub fn static_lib_name(name: &str) -> String {
107111 // endif
108112 // ```
109113 assert ! ( !name. contains( char :: is_whitespace) , "static library name cannot contain whitespace" ) ;
110-
111- if is_msvc ( ) {
112- format ! ( "{name}.lib" )
113- } else {
114- format ! ( "lib{name}.a" )
115- }
114+ if is_msvc ( ) { format ! ( "{name}.lib" ) } else { format ! ( "lib{name}.a" ) }
116115}
117116
118117/// Construct a path to a dynamic library under `$TMPDIR` given the library name. This will return a
@@ -155,11 +154,7 @@ pub fn rust_lib(name: &str) -> PathBuf {
155154
156155/// Construct the binary name based on platform.
157156pub fn bin_name ( name : & str ) -> String {
158- if is_windows ( ) {
159- format ! ( "{name}.exe" )
160- } else {
161- name. to_string ( )
162- }
157+ if is_windows ( ) { format ! ( "{name}.exe" ) } else { name. to_string ( ) }
163158}
164159
165160/// Use `cygpath -w` on a path to get a Windows path string back. This assumes that `cygpath` is
0 commit comments