@@ -382,7 +382,7 @@ impl Error {
382
382
383
383
impl From < io:: Error > for Error {
384
384
fn from ( e : io:: Error ) -> Error {
385
- Error :: new ( ErrorKind :: IOError , format ! ( "{}" , e ) )
385
+ Error :: new ( ErrorKind :: IOError , format ! ( "{e}" ) )
386
386
}
387
387
}
388
388
@@ -1463,7 +1463,7 @@ impl Build {
1463
1463
1464
1464
if self . link_lib_modifiers . is_empty ( ) {
1465
1465
self . cargo_output
1466
- . print_metadata ( & format_args ! ( "cargo:rustc-link-lib=static={}" , lib_name ) ) ;
1466
+ . print_metadata ( & format_args ! ( "cargo:rustc-link-lib=static={lib_name}" ) ) ;
1467
1467
} else {
1468
1468
self . cargo_output . print_metadata ( & format_args ! (
1469
1469
"cargo:rustc-link-lib=static:{}={}" ,
@@ -1551,7 +1551,7 @@ impl Build {
1551
1551
bad => panic ! ( "unsupported cudart option: {}" , bad) ,
1552
1552
} ;
1553
1553
self . cargo_output
1554
- . print_metadata ( & format_args ! ( "cargo:rustc-link-lib={}" , lib ) ) ;
1554
+ . print_metadata ( & format_args ! ( "cargo:rustc-link-lib={lib}" ) ) ;
1555
1555
}
1556
1556
}
1557
1557
@@ -1965,7 +1965,7 @@ impl Build {
1965
1965
ToolFamily :: Msvc { .. } => ':' ,
1966
1966
ToolFamily :: Gnu | ToolFamily :: Clang { .. } => '=' ,
1967
1967
} ;
1968
- cmd. push_cc_arg ( format ! ( "-std{}{}" , separator , std ) . into ( ) ) ;
1968
+ cmd. push_cc_arg ( format ! ( "-std{separator}{std}" ) . into ( ) ) ;
1969
1969
}
1970
1970
for directory in self . include_directories . iter ( ) {
1971
1971
cmd. args . push ( "-I" . into ( ) ) ;
@@ -2011,9 +2011,9 @@ impl Build {
2011
2011
}
2012
2012
for ( key, value) in self . definitions . iter ( ) {
2013
2013
if let Some ( ref value) = * value {
2014
- cmd. args . push ( format ! ( "-D{}={}" , key , value ) . into ( ) ) ;
2014
+ cmd. args . push ( format ! ( "-D{key }={value}" ) . into ( ) ) ;
2015
2015
} else {
2016
- cmd. args . push ( format ! ( "-D{}" , key ) . into ( ) ) ;
2016
+ cmd. args . push ( format ! ( "-D{key}" ) . into ( ) ) ;
2017
2017
}
2018
2018
}
2019
2019
@@ -2069,7 +2069,7 @@ impl Build {
2069
2069
if opt_level == "z" && !cmd. is_like_clang ( ) {
2070
2070
cmd. push_opt_unless_duplicate ( "-Os" . into ( ) ) ;
2071
2071
} else {
2072
- cmd. push_opt_unless_duplicate ( format ! ( "-O{}" , opt_level ) . into ( ) ) ;
2072
+ cmd. push_opt_unless_duplicate ( format ! ( "-O{opt_level}" ) . into ( ) ) ;
2073
2073
}
2074
2074
2075
2075
if cmd. is_like_clang ( ) && target. os == "android" {
@@ -2498,7 +2498,7 @@ impl Build {
2498
2498
match ( self . cpp_set_stdlib . as_ref ( ) , cmd. family ) {
2499
2499
( None , _) => { }
2500
2500
( Some ( stdlib) , ToolFamily :: Gnu ) | ( Some ( stdlib) , ToolFamily :: Clang { .. } ) => {
2501
- cmd. push_cc_arg ( format ! ( "-stdlib=lib{}" , stdlib ) . into ( ) ) ;
2501
+ cmd. push_cc_arg ( format ! ( "-stdlib=lib{stdlib}" ) . into ( ) ) ;
2502
2502
}
2503
2503
_ => {
2504
2504
self . cargo_output . print_warning ( & format_args ! ( "cpp_set_stdlib is specified, but the {:?} compiler does not support this option, ignored" , cmd. family) ) ;
@@ -2553,11 +2553,11 @@ impl Build {
2553
2553
cmd. arg ( "-PreDefine" ) ;
2554
2554
if let Some ( ref value) = * value {
2555
2555
if let Ok ( i) = value. parse :: < i32 > ( ) {
2556
- cmd. arg ( format ! ( "{} SETA {}" , key , i ) ) ;
2556
+ cmd. arg ( format ! ( "{key } SETA {i}" ) ) ;
2557
2557
} else if value. starts_with ( '"' ) && value. ends_with ( '"' ) {
2558
- cmd. arg ( format ! ( "{} SETS {}" , key , value ) ) ;
2558
+ cmd. arg ( format ! ( "{key } SETS {value}" ) ) ;
2559
2559
} else {
2560
- cmd. arg ( format ! ( "{} SETS \" {}\" " , key , value ) ) ;
2560
+ cmd. arg ( format ! ( "{key } SETS \" {value }\" " ) ) ;
2561
2561
}
2562
2562
} else {
2563
2563
cmd. arg ( format ! ( "{} SETL {}" , key, "{TRUE}" ) ) ;
@@ -2570,9 +2570,9 @@ impl Build {
2570
2570
2571
2571
for ( key, value) in self . definitions . iter ( ) {
2572
2572
if let Some ( ref value) = * value {
2573
- cmd. arg ( format ! ( "-D{}={}" , key , value ) ) ;
2573
+ cmd. arg ( format ! ( "-D{key }={value}" ) ) ;
2574
2574
} else {
2575
- cmd. arg ( format ! ( "-D{}" , key ) ) ;
2575
+ cmd. arg ( format ! ( "-D{key}" ) ) ;
2576
2576
}
2577
2577
}
2578
2578
}
@@ -2619,7 +2619,7 @@ impl Build {
2619
2619
// MSVC linker will also be passed foo.lib, so be sure that both
2620
2620
// exist for now.
2621
2621
2622
- let lib_dst = dst. with_file_name ( format ! ( "{}.lib" , lib_name ) ) ;
2622
+ let lib_dst = dst. with_file_name ( format ! ( "{lib_name }.lib" ) ) ;
2623
2623
let _ = fs:: remove_file ( & lib_dst) ;
2624
2624
match fs:: hard_link ( dst, & lib_dst) . or_else ( |_| {
2625
2625
// if hard-link fails, just copy (ignoring the number of bytes written)
@@ -2852,7 +2852,7 @@ impl Build {
2852
2852
ToolFamily :: Clang { zig_cc : false } ,
2853
2853
) ;
2854
2854
t. args . push ( "/c" . into ( ) ) ;
2855
- t. args . push ( format ! ( "{}.bat" , tool ) . into ( ) ) ;
2855
+ t. args . push ( format ! ( "{tool }.bat" ) . into ( ) ) ;
2856
2856
Some ( t)
2857
2857
} else {
2858
2858
Some ( Tool :: new (
@@ -2876,7 +2876,7 @@ impl Build {
2876
2876
msvc. to_string ( )
2877
2877
} else {
2878
2878
let cc = if target. abi == "llvm" { clang } else { gnu } ;
2879
- format ! ( "{}.exe" , cc )
2879
+ format ! ( "{cc }.exe" )
2880
2880
}
2881
2881
} else if target. os == "ios"
2882
2882
|| target. os == "watchos"
@@ -2902,9 +2902,9 @@ impl Build {
2902
2902
"wr-cc" . to_string ( )
2903
2903
}
2904
2904
} else if target. arch == "arm" && target. vendor == "kmc" {
2905
- format ! ( "arm-kmc-eabi-{}" , gnu )
2905
+ format ! ( "arm-kmc-eabi-{gnu}" )
2906
2906
} else if target. arch == "aarch64" && target. vendor == "kmc" {
2907
- format ! ( "aarch64-kmc-elf-{}" , gnu )
2907
+ format ! ( "aarch64-kmc-elf-{gnu}" )
2908
2908
} else if target. os == "nto" {
2909
2909
// See for details: https://github.com/rust-lang/cc-rs/pull/1319
2910
2910
if self . cpp {
@@ -2917,7 +2917,7 @@ impl Build {
2917
2917
match prefix {
2918
2918
Some ( prefix) => {
2919
2919
let cc = if target. abi == "llvm" { clang } else { gnu } ;
2920
- format ! ( "{}-{}" , prefix , cc )
2920
+ format ! ( "{prefix }-{cc}" )
2921
2921
}
2922
2922
None => default. to_string ( ) ,
2923
2923
}
@@ -2988,7 +2988,7 @@ impl Build {
2988
2988
tool. has_internal_target_arg = true ;
2989
2989
tool. path . set_file_name ( clang. trim_start_matches ( '-' ) ) ;
2990
2990
tool. path . set_extension ( "exe" ) ;
2991
- tool. args . push ( format ! ( "--target={}" , target ) . into ( ) ) ;
2991
+ tool. args . push ( format ! ( "--target={target}" ) . into ( ) ) ;
2992
2992
2993
2993
// Additionally, shell scripts for target i686-linux-android versions 16 to 24
2994
2994
// pass the `mstackrealign` option so we do that here as well.
@@ -3275,11 +3275,11 @@ impl Build {
3275
3275
// Windows use bat files so we have to be a bit more specific
3276
3276
if cfg ! ( windows) {
3277
3277
let mut cmd = self . cmd ( "cmd" ) ;
3278
- name = format ! ( "em{}.bat" , tool ) . into ( ) ;
3278
+ name = format ! ( "em{tool }.bat" ) . into ( ) ;
3279
3279
cmd. arg ( "/c" ) . arg ( & name) ;
3280
3280
Some ( cmd)
3281
3281
} else {
3282
- name = format ! ( "em{}" , tool ) . into ( ) ;
3282
+ name = format ! ( "em{tool}" ) . into ( ) ;
3283
3283
Some ( self . cmd ( & name) )
3284
3284
}
3285
3285
} else if target. arch == "wasm32" || target. arch == "wasm64" {
@@ -3290,7 +3290,7 @@ impl Build {
3290
3290
// of "llvm-ar"...
3291
3291
let compiler = self . get_base_compiler ( ) . ok ( ) ?;
3292
3292
if compiler. is_like_clang ( ) {
3293
- name = format ! ( "llvm-{}" , tool ) . into ( ) ;
3293
+ name = format ! ( "llvm-{tool}" ) . into ( ) ;
3294
3294
self . search_programs (
3295
3295
& mut self . cmd ( & compiler. path ) ,
3296
3296
& name,
@@ -3309,7 +3309,7 @@ impl Build {
3309
3309
Some ( t) => t,
3310
3310
None => {
3311
3311
if target. os == "android" {
3312
- name = format ! ( "llvm-{}" , tool ) . into ( ) ;
3312
+ name = format ! ( "llvm-{tool}" ) . into ( ) ;
3313
3313
match Command :: new ( & name) . arg ( "--version" ) . status ( ) {
3314
3314
Ok ( status) if status. success ( ) => ( ) ,
3315
3315
_ => {
@@ -3361,15 +3361,15 @@ impl Build {
3361
3361
// but the OS comes bundled with a GNU-compatible variant.
3362
3362
//
3363
3363
// Use the GNU-variant to match other Unix systems.
3364
- name = format ! ( "g{}" , tool ) . into ( ) ;
3364
+ name = format ! ( "g{tool}" ) . into ( ) ;
3365
3365
self . cmd ( & name)
3366
3366
} else if target. os == "vxworks" {
3367
- name = format ! ( "wr-{}" , tool ) . into ( ) ;
3367
+ name = format ! ( "wr-{tool}" ) . into ( ) ;
3368
3368
self . cmd ( & name)
3369
3369
} else if target. os == "nto" {
3370
3370
// Ref: https://www.qnx.com/developers/docs/8.0/com.qnx.doc.neutrino.utilities/topic/a/ar.html
3371
3371
name = match target. full_arch {
3372
- "i586" => format ! ( "ntox86-{}" , tool ) . into ( ) ,
3372
+ "i586" => format ! ( "ntox86-{tool}" ) . into ( ) ,
3373
3373
"x86" | "aarch64" | "x86_64" => {
3374
3374
format ! ( "nto{}-{}" , target. arch, tool) . into ( )
3375
3375
}
@@ -3582,7 +3582,7 @@ impl Build {
3582
3582
. and_then ( |path_entries| {
3583
3583
env:: split_paths ( path_entries) . find_map ( |path_entry| {
3584
3584
for prefix in prefixes {
3585
- let target_compiler = format ! ( "{}{}{}" , prefix , suffix , extension ) ;
3585
+ let target_compiler = format ! ( "{prefix}{suffix}{extension}" ) ;
3586
3586
if path_entry. join ( & target_compiler) . exists ( ) {
3587
3587
return Some ( prefix) ;
3588
3588
}
@@ -3706,7 +3706,7 @@ impl Build {
3706
3706
// <https://github.com/rust-lang/cc-rs/pull/1215> for details.
3707
3707
if self . emit_rerun_if_env_changed && !provided_by_cargo ( v) && v != "PATH" {
3708
3708
self . cargo_output
3709
- . print_metadata ( & format_args ! ( "cargo:rerun-if-env-changed={}" , v ) ) ;
3709
+ . print_metadata ( & format_args ! ( "cargo:rerun-if-env-changed={v}" ) ) ;
3710
3710
}
3711
3711
let r = env:: var_os ( v) . map ( Arc :: from) ;
3712
3712
self . cargo_output . print_metadata ( & format_args ! (
@@ -3735,7 +3735,7 @@ impl Build {
3735
3735
Some ( s) => Ok ( s) ,
3736
3736
None => Err ( Error :: new (
3737
3737
ErrorKind :: EnvVarNotFound ,
3738
- format ! ( "Environment variable {} not defined." , v ) ,
3738
+ format ! ( "Environment variable {v } not defined." ) ,
3739
3739
) ) ,
3740
3740
}
3741
3741
}
@@ -3745,7 +3745,7 @@ impl Build {
3745
3745
env. to_str ( ) . map ( String :: from) . ok_or_else ( || {
3746
3746
Error :: new (
3747
3747
ErrorKind :: EnvVarNotFound ,
3748
- format ! ( "Environment variable {} is not valid utf-8." , v ) ,
3748
+ format ! ( "Environment variable {v } is not valid utf-8." ) ,
3749
3749
)
3750
3750
} )
3751
3751
}
@@ -3956,8 +3956,7 @@ impl Build {
3956
3956
// If below 10.9, we ignore it and let the SDK's target definitions handle it.
3957
3957
if major == 10 && minor < 9 {
3958
3958
self . cargo_output . print_warning ( & format_args ! (
3959
- "macOS deployment target ({}) too low, it will be increased" ,
3960
- deployment_target_ver
3959
+ "macOS deployment target ({deployment_target_ver}) too low, it will be increased"
3961
3960
) ) ;
3962
3961
return None ;
3963
3962
}
@@ -3968,8 +3967,7 @@ impl Build {
3968
3967
// If below 10.7, we ignore it and let the SDK's target definitions handle it.
3969
3968
if major < 7 {
3970
3969
self . cargo_output . print_warning ( & format_args ! (
3971
- "iOS deployment target ({}) too low, it will be increased" ,
3972
- deployment_target_ver
3970
+ "iOS deployment target ({deployment_target_ver}) too low, it will be increased"
3973
3971
) ) ;
3974
3972
return None ;
3975
3973
}
@@ -4140,7 +4138,7 @@ impl Default for Build {
4140
4138
}
4141
4139
4142
4140
fn fail ( s : & str ) -> ! {
4143
- eprintln ! ( "\n \n error occurred in cc-rs: {}\n \n " , s ) ;
4141
+ eprintln ! ( "\n \n error occurred in cc-rs: {s }\n \n " ) ;
4144
4142
std:: process:: exit ( 1 ) ;
4145
4143
}
4146
4144
@@ -4202,13 +4200,13 @@ fn autodetect_android_compiler(raw_target: &str, gnu: &str, clang: &str) -> Stri
4202
4200
. replace ( "armv7" , "arm" )
4203
4201
. replace ( "thumbv7neon" , "arm" )
4204
4202
. replace ( "thumbv7" , "arm" ) ;
4205
- let gnu_compiler = format ! ( "{}-{}" , target , gnu ) ;
4206
- let clang_compiler = format ! ( "{}-{}" , target , clang ) ;
4203
+ let gnu_compiler = format ! ( "{target }-{gnu}" ) ;
4204
+ let clang_compiler = format ! ( "{target }-{clang}" ) ;
4207
4205
4208
4206
// On Windows, the Android clang compiler is provided as a `.cmd` file instead
4209
4207
// of a `.exe` file. `std::process::Command` won't run `.cmd` files unless the
4210
4208
// `.cmd` is explicitly appended to the command name, so we do that here.
4211
- let clang_compiler_cmd = format ! ( "{}-{}.cmd" , target , clang ) ;
4209
+ let clang_compiler_cmd = format ! ( "{target }-{clang }.cmd" ) ;
4212
4210
4213
4211
// Check if gnu compiler is present
4214
4212
// if not, use clang
0 commit comments