@@ -2901,64 +2901,57 @@ impl Build {
2901
2901
let tool = match tool_opt {
2902
2902
Some ( t) => t,
2903
2903
None => {
2904
- let compiler = if cfg ! ( windows) && target. os == "windows" {
2904
+ let compiler: PathBuf = if cfg ! ( windows) && target. os == "windows" {
2905
2905
if target. env == "msvc" {
2906
- msvc. to_string ( )
2906
+ msvc. into ( )
2907
2907
} else {
2908
2908
let cc = if target. abi == "llvm" { clang } else { gnu } ;
2909
- format ! ( "{cc}.exe" )
2909
+ format ! ( "{cc}.exe" ) . into ( )
2910
2910
}
2911
2911
} else if target. os == "ios"
2912
2912
|| target. os == "watchos"
2913
2913
|| target. os == "tvos"
2914
2914
|| target. os == "visionos"
2915
2915
{
2916
- clang. to_string ( )
2916
+ clang. into ( )
2917
2917
} else if target. os == "android" {
2918
2918
autodetect_android_compiler ( & raw_target, gnu, clang)
2919
2919
} else if target. os == "cloudabi" {
2920
2920
format ! (
2921
2921
"{}-{}-{}-{}" ,
2922
2922
target. full_arch, target. vendor, target. os, traditional
2923
2923
)
2924
+ . into ( )
2924
2925
} else if target. os == "wasi" {
2925
2926
self . autodetect_wasi_compiler ( & raw_target, clang)
2926
2927
} else if target. arch == "wasm32" || target. arch == "wasm64" {
2927
2928
// Compiling WASM is not currently supported by GCC, so
2928
2929
// let's default to Clang.
2929
- clang. to_string ( )
2930
+ clang. into ( )
2930
2931
} else if target. os == "vxworks" {
2931
- if self . cpp {
2932
- "wr-c++" . to_string ( )
2933
- } else {
2934
- "wr-cc" . to_string ( )
2935
- }
2932
+ if self . cpp { "wr-c++" } else { "wr-cc" } . into ( )
2936
2933
} else if target. arch == "arm" && target. vendor == "kmc" {
2937
- format ! ( "arm-kmc-eabi-{gnu}" )
2934
+ format ! ( "arm-kmc-eabi-{gnu}" ) . into ( )
2938
2935
} else if target. arch == "aarch64" && target. vendor == "kmc" {
2939
- format ! ( "aarch64-kmc-elf-{gnu}" )
2936
+ format ! ( "aarch64-kmc-elf-{gnu}" ) . into ( )
2940
2937
} else if target. os == "nto" {
2941
2938
// See for details: https://github.com/rust-lang/cc-rs/pull/1319
2942
- if self . cpp {
2943
- "q++" . to_string ( )
2944
- } else {
2945
- "qcc" . to_string ( )
2946
- }
2939
+ if self . cpp { "q++" } else { "qcc" } . into ( )
2947
2940
} else if self . get_is_cross_compile ( ) ? {
2948
2941
let prefix = self . prefix_for_target ( & raw_target) ;
2949
2942
match prefix {
2950
2943
Some ( prefix) => {
2951
2944
let cc = if target. abi == "llvm" { clang } else { gnu } ;
2952
- format ! ( "{prefix}-{cc}" )
2945
+ format ! ( "{prefix}-{cc}" ) . into ( )
2953
2946
}
2954
- None => default. to_string ( ) ,
2947
+ None => default. into ( ) ,
2955
2948
}
2956
2949
} else {
2957
- default. to_string ( )
2950
+ default. into ( )
2958
2951
} ;
2959
2952
2960
2953
let mut t = Tool :: new (
2961
- PathBuf :: from ( compiler) ,
2954
+ compiler,
2962
2955
& self . build_cache . cached_compiler_family ,
2963
2956
& self . cargo_output ,
2964
2957
out_dir,
@@ -4178,19 +4171,17 @@ impl Build {
4178
4171
/// have support for compiling to wasm.
4179
4172
///
4180
4173
/// [wasi-sdk]: https://github.com/WebAssembly/wasi-sdk
4181
- fn autodetect_wasi_compiler ( & self , raw_target : & str , clang : & str ) -> String {
4174
+ fn autodetect_wasi_compiler ( & self , raw_target : & str , clang : & str ) -> PathBuf {
4182
4175
if let Some ( path) = self . getenv ( "WASI_SDK_PATH" ) {
4183
4176
let target_clang = Path :: new ( & path)
4184
4177
. join ( "bin" )
4185
4178
. join ( format ! ( "{raw_target}-clang" ) ) ;
4186
4179
if let Some ( path) = self . which ( & target_clang, None ) {
4187
- if let Some ( s) = path. to_str ( ) {
4188
- return s. to_string ( ) ;
4189
- }
4180
+ return path;
4190
4181
}
4191
4182
}
4192
4183
4193
- clang. to_string ( )
4184
+ clang. into ( )
4194
4185
}
4195
4186
}
4196
4187
@@ -4235,7 +4226,7 @@ fn android_clang_compiler_uses_target_arg_internally(clang_path: &Path) -> bool
4235
4226
}
4236
4227
4237
4228
// FIXME: Use parsed target.
4238
- fn autodetect_android_compiler ( raw_target : & str , gnu : & str , clang : & str ) -> String {
4229
+ fn autodetect_android_compiler ( raw_target : & str , gnu : & str , clang : & str ) -> PathBuf {
4239
4230
let new_clang_key = match raw_target {
4240
4231
"aarch64-linux-android" => Some ( "aarch64" ) ,
4241
4232
"armv7-linux-androideabi" => Some ( "armv7a" ) ,
@@ -4280,6 +4271,7 @@ fn autodetect_android_compiler(raw_target: &str, gnu: &str, clang: &str) -> Stri
4280
4271
} else {
4281
4272
clang_compiler
4282
4273
}
4274
+ . into ( )
4283
4275
}
4284
4276
4285
4277
// Rust and clang/cc don't agree on how to name the target.
0 commit comments