@@ -77,14 +77,19 @@ 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)
84+ . expect ( & format ! ( "failed to create symlink {} for {}" , link, original) ) ;
85+ }
86+
87+ /// Creates a new symlink to a path on the filesystem, adjusting for Windows or Unix.
88+ #[ cfg( target_family = "unix" ) ]
89+ pub fn create_symlink < P : AsRef < Path > , Q : AsRef < Path > > ( original : P , link : Q ) {
90+ use std:: os:: unix:: fs;
91+ fs:: symlink ( original, link)
92+ . expect ( & format ! ( "failed to create symlink {} for {}" , link, original) ) ;
8893}
8994
9095/// Construct the static library name based on the platform.
@@ -108,11 +113,7 @@ pub fn static_lib_name(name: &str) -> String {
108113 // ```
109114 assert ! ( !name. contains( char :: is_whitespace) , "static library name cannot contain whitespace" ) ;
110115
111- if is_msvc ( ) {
112- format ! ( "{name}.lib" )
113- } else {
114- format ! ( "lib{name}.a" )
115- }
116+ if is_msvc ( ) { format ! ( "{name}.lib" ) } else { format ! ( "lib{name}.a" ) }
116117}
117118
118119/// Construct a path to a dynamic library under `$TMPDIR` given the library name. This will return a
@@ -155,11 +156,7 @@ pub fn rust_lib(name: &str) -> PathBuf {
155156
156157/// Construct the binary name based on platform.
157158pub fn bin_name ( name : & str ) -> String {
158- if is_windows ( ) {
159- format ! ( "{name}.exe" )
160- } else {
161- name. to_string ( )
162- }
159+ if is_windows ( ) { format ! ( "{name}.exe" ) } else { name. to_string ( ) }
163160}
164161
165162/// Use `cygpath -w` on a path to get a Windows path string back. This assumes that `cygpath` is
0 commit comments