@@ -66,7 +66,7 @@ impl ConfigFile {
6666 "Expected a boolean for `download-gccjit`" ,
6767 ) ;
6868 }
69- _ => return failed_config_parsing ( config_file, & format ! ( "Unknown key `{}`" , key ) ) ,
69+ _ => return failed_config_parsing ( config_file, & format ! ( "Unknown key `{key }`" ) ) ,
7070 }
7171 }
7272 match ( config. gcc_path . as_mut ( ) , config. download_gccjit ) {
@@ -86,9 +86,7 @@ impl ConfigFile {
8686 let path = Path :: new ( gcc_path) ;
8787 * gcc_path = path
8888 . 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:?}" ) ) ?
9290 . display ( )
9391 . to_string ( ) ;
9492 }
@@ -175,7 +173,7 @@ impl ConfigInfo {
175173 "--sysroot-panic-abort" => self . sysroot_panic_abort = true ,
176174 "--gcc-path" => match args. next ( ) {
177175 Some ( arg) if !arg. is_empty ( ) => {
178- self . gcc_path = Some ( arg. into ( ) ) ;
176+ self . gcc_path = Some ( arg) ;
179177 }
180178 _ => {
181179 return Err ( "Expected a value after `--gcc-path`, found nothing" . to_string ( ) ) ;
@@ -244,7 +242,7 @@ impl ConfigInfo {
244242 let libgccjit_so = output_dir. join ( libgccjit_so_name) ;
245243 if !libgccjit_so. is_file ( ) && !self . no_download {
246244 // Download time!
247- let tempfile_name = format ! ( "{}.download" , libgccjit_so_name ) ;
245+ let tempfile_name = format ! ( "{libgccjit_so_name }.download" ) ;
248246 let tempfile = output_dir. join ( & tempfile_name) ;
249247 let is_in_ci = std:: env:: var ( "GITHUB_ACTIONS" ) . is_ok ( ) ;
250248
@@ -262,14 +260,14 @@ impl ConfigInfo {
262260 )
263261 } ) ?;
264262
265- println ! ( "Downloaded libgccjit.so version {} successfully!" , commit ) ;
263+ println ! ( "Downloaded libgccjit.so version {commit } successfully!" ) ;
266264 // We need to create a link named `libgccjit.so.0` because that's what the linker is
267265 // 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" ) ) ) ?;
269267 }
270268
271269 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" ) ;
273271 self . gcc_path = Some ( gcc_path) ;
274272 Ok ( ( ) )
275273 }
@@ -286,8 +284,7 @@ impl ConfigInfo {
286284 // since we already have everything we need.
287285 if let Some ( gcc_path) = & self . gcc_path {
288286 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"
291288 ) ;
292289 return Ok ( ( ) ) ;
293290 }
@@ -343,7 +340,7 @@ impl ConfigInfo {
343340 self . dylib_ext = match os_name. as_str ( ) {
344341 "Linux" => "so" ,
345342 "Darwin" => "dylib" ,
346- os => return Err ( format ! ( "unsupported OS `{}`" , os ) ) ,
343+ os => return Err ( format ! ( "unsupported OS `{os }`" ) ) ,
347344 }
348345 . to_string ( ) ;
349346 let rustc = match env. get ( "RUSTC" ) {
@@ -355,10 +352,10 @@ impl ConfigInfo {
355352 None => return Err ( "no host found" . to_string ( ) ) ,
356353 } ;
357354
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 ( ) ;
362359 }
363360 if self . target_triple . is_empty ( ) {
364361 self . target_triple = self . host_triple . clone ( ) ;
@@ -378,7 +375,7 @@ impl ConfigInfo {
378375 }
379376
380377 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 :?}" ) ) ?;
382379 let channel = if self . channel == Channel :: Release {
383380 "release"
384381 } else if let Some ( channel) = env. get ( "CHANNEL" ) {
@@ -391,15 +388,15 @@ impl ConfigInfo {
391388 self . cg_backend_path = current_dir
392389 . join ( "target" )
393390 . join ( channel)
394- . join ( & format ! ( "librustc_codegen_gcc.{}" , self . dylib_ext) )
391+ . join ( format ! ( "librustc_codegen_gcc.{}" , self . dylib_ext) )
395392 . display ( )
396393 . to_string ( ) ;
397394 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 ( ) ;
399396 if let Some ( backend) = & self . backend {
400397 // This option is only used in the rust compiler testsuite. The sysroot is handled
401398 // 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}" ) ) ;
403400 } else {
404401 rustflags. extend_from_slice ( & [
405402 "--sysroot" . to_string ( ) ,
@@ -412,10 +409,10 @@ impl ConfigInfo {
412409 // We have a different environment variable than RUSTFLAGS to make sure those flags are
413410 // only sent to rustc_codegen_gcc and not the LLVM backend.
414411 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) ?) ;
416413 }
417414 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) ?) ;
419416 }
420417
421418 if let Some ( linker) = linker {
@@ -438,8 +435,8 @@ impl ConfigInfo {
438435 env. insert ( "RUSTC_LOG" . to_string ( ) , "warn" . to_string ( ) ) ;
439436
440437 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) ) ;
443440 let ld_library_path = format ! (
444441 "{target}:{sysroot}:{gcc_path}" ,
445442 target = self . cargo_target_dir,
@@ -505,7 +502,7 @@ fn download_gccjit(
505502 with_progress_bar : bool ,
506503) -> Result < ( ) , String > {
507504 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" )
509506 } else {
510507 eprintln ! (
511508 "\
@@ -518,7 +515,7 @@ to `download-gccjit = false` and set `gcc-path` to the appropriate directory."
518515 ) ) ;
519516 } ;
520517
521- println ! ( "Downloading `{}`..." , url ) ;
518+ println ! ( "Downloading `{url }`..." ) ;
522519
523520 // Try curl. If that fails and we are on windows, fallback to PowerShell.
524521 let mut ret = run_command_with_output (
@@ -538,7 +535,7 @@ to `download-gccjit = false` and set `gcc-path` to the appropriate directory."
538535 if with_progress_bar { & "--progress-bar" } else { & "-s" } ,
539536 & url. as_str ( ) ,
540537 ] ,
541- Some ( & output_dir) ,
538+ Some ( output_dir) ,
542539 ) ;
543540 if ret. is_err ( ) && cfg ! ( windows) {
544541 eprintln ! ( "Fallback to PowerShell" ) ;
@@ -549,12 +546,11 @@ to `download-gccjit = false` and set `gcc-path` to the appropriate directory."
549546 & "-Command" ,
550547 & "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;" ,
551548 & format ! (
552- "(New-Object System.Net.WebClient).DownloadFile('{}', '{}')" ,
553- url, tempfile_name,
549+ "(New-Object System.Net.WebClient).DownloadFile('{url}', '{tempfile_name}')" ,
554550 )
555551 . as_str ( ) ,
556552 ] ,
557- Some ( & output_dir) ,
553+ Some ( output_dir) ,
558554 ) ;
559555 }
560556 ret
0 commit comments