@@ -66,7 +66,7 @@ impl ConfigFile {
66
66
"Expected a boolean for `download-gccjit`" ,
67
67
) ;
68
68
}
69
- _ => return failed_config_parsing ( config_file, & format ! ( "Unknown key `{}`" , key ) ) ,
69
+ _ => return failed_config_parsing ( config_file, & format ! ( "Unknown key `{key }`" ) ) ,
70
70
}
71
71
}
72
72
match ( config. gcc_path . as_mut ( ) , config. download_gccjit ) {
@@ -86,9 +86,7 @@ impl ConfigFile {
86
86
let path = Path :: new ( gcc_path) ;
87
87
* gcc_path = path
88
88
. canonicalize ( )
89
- . map_err ( |err| {
90
- format ! ( "Failed to get absolute path of `{}`: {:?}" , gcc_path, err)
91
- } ) ?
89
+ . map_err ( |err| format ! ( "Failed to get absolute path of `{gcc_path}`: {err:?}" ) ) ?
92
90
. display ( )
93
91
. to_string ( ) ;
94
92
}
@@ -175,7 +173,7 @@ impl ConfigInfo {
175
173
"--sysroot-panic-abort" => self . sysroot_panic_abort = true ,
176
174
"--gcc-path" => match args. next ( ) {
177
175
Some ( arg) if !arg. is_empty ( ) => {
178
- self . gcc_path = Some ( arg. into ( ) ) ;
176
+ self . gcc_path = Some ( arg) ;
179
177
}
180
178
_ => {
181
179
return Err ( "Expected a value after `--gcc-path`, found nothing" . to_string ( ) ) ;
@@ -244,7 +242,7 @@ impl ConfigInfo {
244
242
let libgccjit_so = output_dir. join ( libgccjit_so_name) ;
245
243
if !libgccjit_so. is_file ( ) && !self . no_download {
246
244
// Download time!
247
- let tempfile_name = format ! ( "{}.download" , libgccjit_so_name ) ;
245
+ let tempfile_name = format ! ( "{libgccjit_so_name }.download" ) ;
248
246
let tempfile = output_dir. join ( & tempfile_name) ;
249
247
let is_in_ci = std:: env:: var ( "GITHUB_ACTIONS" ) . is_ok ( ) ;
250
248
@@ -262,14 +260,14 @@ impl ConfigInfo {
262
260
)
263
261
} ) ?;
264
262
265
- println ! ( "Downloaded libgccjit.so version {} successfully!" , commit ) ;
263
+ println ! ( "Downloaded libgccjit.so version {commit } successfully!" ) ;
266
264
// We need to create a link named `libgccjit.so.0` because that's what the linker is
267
265
// looking for.
268
- create_symlink ( & libgccjit_so, output_dir. join ( & format ! ( "{}.0" , libgccjit_so_name ) ) ) ?;
266
+ create_symlink ( & libgccjit_so, output_dir. join ( format ! ( "{libgccjit_so_name }.0" ) ) ) ?;
269
267
}
270
268
271
269
let gcc_path = output_dir. display ( ) . to_string ( ) ;
272
- println ! ( "Using `{}` as path for libgccjit" , gcc_path ) ;
270
+ println ! ( "Using `{gcc_path }` as path for libgccjit" ) ;
273
271
self . gcc_path = Some ( gcc_path) ;
274
272
Ok ( ( ) )
275
273
}
@@ -286,8 +284,7 @@ impl ConfigInfo {
286
284
// since we already have everything we need.
287
285
if let Some ( gcc_path) = & self . gcc_path {
288
286
println ! (
289
- "`--gcc-path` was provided, ignoring config file. Using `{}` as path for libgccjit" ,
290
- gcc_path
287
+ "`--gcc-path` was provided, ignoring config file. Using `{gcc_path}` as path for libgccjit"
291
288
) ;
292
289
return Ok ( ( ) ) ;
293
290
}
@@ -343,7 +340,7 @@ impl ConfigInfo {
343
340
self . dylib_ext = match os_name. as_str ( ) {
344
341
"Linux" => "so" ,
345
342
"Darwin" => "dylib" ,
346
- os => return Err ( format ! ( "unsupported OS `{}`" , os ) ) ,
343
+ os => return Err ( format ! ( "unsupported OS `{os }`" ) ) ,
347
344
}
348
345
. to_string ( ) ;
349
346
let rustc = match env. get ( "RUSTC" ) {
@@ -355,10 +352,10 @@ impl ConfigInfo {
355
352
None => return Err ( "no host found" . to_string ( ) ) ,
356
353
} ;
357
354
358
- if self . target_triple . is_empty ( ) {
359
- if let Some ( overwrite) = env. get ( "OVERWRITE_TARGET_TRIPLE" ) {
360
- self . target_triple = overwrite . clone ( ) ;
361
- }
355
+ if self . target_triple . is_empty ( )
356
+ && let Some ( overwrite) = env. get ( "OVERWRITE_TARGET_TRIPLE" )
357
+ {
358
+ self . target_triple = overwrite . clone ( ) ;
362
359
}
363
360
if self . target_triple . is_empty ( ) {
364
361
self . target_triple = self . host_triple . clone ( ) ;
@@ -378,7 +375,7 @@ impl ConfigInfo {
378
375
}
379
376
380
377
let current_dir =
381
- std_env:: current_dir ( ) . map_err ( |error| format ! ( "`current_dir` failed: {:?}" , error ) ) ?;
378
+ std_env:: current_dir ( ) . map_err ( |error| format ! ( "`current_dir` failed: {error :?}" ) ) ?;
382
379
let channel = if self . channel == Channel :: Release {
383
380
"release"
384
381
} else if let Some ( channel) = env. get ( "CHANNEL" ) {
@@ -391,15 +388,15 @@ impl ConfigInfo {
391
388
self . cg_backend_path = current_dir
392
389
. join ( "target" )
393
390
. join ( channel)
394
- . join ( & format ! ( "librustc_codegen_gcc.{}" , self . dylib_ext) )
391
+ . join ( format ! ( "librustc_codegen_gcc.{}" , self . dylib_ext) )
395
392
. display ( )
396
393
. to_string ( ) ;
397
394
self . sysroot_path =
398
- current_dir. join ( & get_sysroot_dir ( ) ) . join ( "sysroot" ) . display ( ) . to_string ( ) ;
395
+ current_dir. join ( get_sysroot_dir ( ) ) . join ( "sysroot" ) . display ( ) . to_string ( ) ;
399
396
if let Some ( backend) = & self . backend {
400
397
// This option is only used in the rust compiler testsuite. The sysroot is handled
401
398
// by its build system directly so no need to set it ourselves.
402
- rustflags. push ( format ! ( "-Zcodegen-backend={}" , backend ) ) ;
399
+ rustflags. push ( format ! ( "-Zcodegen-backend={backend}" ) ) ;
403
400
} else {
404
401
rustflags. extend_from_slice ( & [
405
402
"--sysroot" . to_string ( ) ,
@@ -412,10 +409,10 @@ impl ConfigInfo {
412
409
// We have a different environment variable than RUSTFLAGS to make sure those flags are
413
410
// only sent to rustc_codegen_gcc and not the LLVM backend.
414
411
if let Some ( cg_rustflags) = env. get ( "CG_RUSTFLAGS" ) {
415
- rustflags. extend_from_slice ( & split_args ( & cg_rustflags) ?) ;
412
+ rustflags. extend_from_slice ( & split_args ( cg_rustflags) ?) ;
416
413
}
417
414
if let Some ( test_flags) = env. get ( "TEST_FLAGS" ) {
418
- rustflags. extend_from_slice ( & split_args ( & test_flags) ?) ;
415
+ rustflags. extend_from_slice ( & split_args ( test_flags) ?) ;
419
416
}
420
417
421
418
if let Some ( linker) = linker {
@@ -438,8 +435,8 @@ impl ConfigInfo {
438
435
env. insert ( "RUSTC_LOG" . to_string ( ) , "warn" . to_string ( ) ) ;
439
436
440
437
let sysroot = current_dir
441
- . join ( & get_sysroot_dir ( ) )
442
- . join ( & format ! ( "sysroot/lib/rustlib/{}/lib" , self . target_triple) ) ;
438
+ . join ( get_sysroot_dir ( ) )
439
+ . join ( format ! ( "sysroot/lib/rustlib/{}/lib" , self . target_triple) ) ;
443
440
let ld_library_path = format ! (
444
441
"{target}:{sysroot}:{gcc_path}" ,
445
442
target = self . cargo_target_dir,
@@ -505,7 +502,7 @@ fn download_gccjit(
505
502
with_progress_bar : bool ,
506
503
) -> Result < ( ) , String > {
507
504
let url = if std:: env:: consts:: OS == "linux" && std:: env:: consts:: ARCH == "x86_64" {
508
- format ! ( "https://github.com/rust-lang/gcc/releases/download/master-{}/libgccjit.so" , commit )
505
+ format ! ( "https://github.com/rust-lang/gcc/releases/download/master-{commit }/libgccjit.so" )
509
506
} else {
510
507
eprintln ! (
511
508
"\
@@ -518,7 +515,7 @@ to `download-gccjit = false` and set `gcc-path` to the appropriate directory."
518
515
) ) ;
519
516
} ;
520
517
521
- println ! ( "Downloading `{}`..." , url ) ;
518
+ println ! ( "Downloading `{url }`..." ) ;
522
519
523
520
// Try curl. If that fails and we are on windows, fallback to PowerShell.
524
521
let mut ret = run_command_with_output (
@@ -538,7 +535,7 @@ to `download-gccjit = false` and set `gcc-path` to the appropriate directory."
538
535
if with_progress_bar { & "--progress-bar" } else { & "-s" } ,
539
536
& url. as_str ( ) ,
540
537
] ,
541
- Some ( & output_dir) ,
538
+ Some ( output_dir) ,
542
539
) ;
543
540
if ret. is_err ( ) && cfg ! ( windows) {
544
541
eprintln ! ( "Fallback to PowerShell" ) ;
@@ -549,12 +546,11 @@ to `download-gccjit = false` and set `gcc-path` to the appropriate directory."
549
546
& "-Command" ,
550
547
& "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;" ,
551
548
& format ! (
552
- "(New-Object System.Net.WebClient).DownloadFile('{}', '{}')" ,
553
- url, tempfile_name,
549
+ "(New-Object System.Net.WebClient).DownloadFile('{url}', '{tempfile_name}')" ,
554
550
)
555
551
. as_str ( ) ,
556
552
] ,
557
- Some ( & output_dir) ,
553
+ Some ( output_dir) ,
558
554
) ;
559
555
}
560
556
ret
0 commit comments