@@ -26,18 +26,15 @@ fn main() {
2626}
2727
2828fn fail ( s : & str ) -> ! {
29- println ! ( "\n \n {}\n \n " , s ) ;
29+ println ! ( "\n \n {s }\n \n " ) ;
3030 std:: process:: exit ( 1 ) ;
3131}
3232
3333#[ track_caller]
3434pub fn output ( cmd : & mut Command ) -> String {
3535 let output = match cmd. stderr ( Stdio :: inherit ( ) ) . output ( ) {
3636 Ok ( status) => status,
37- Err ( e) => fail ( & format ! (
38- "failed to execute command: {:?}\n error: {}" ,
39- cmd, e
40- ) ) ,
37+ Err ( e) => fail ( & format ! ( "failed to execute command: {cmd:?}\n error: {e}" ) ) ,
4138 } ;
4239 assert ! (
4340 output. status. success( ) ,
@@ -56,11 +53,10 @@ fn target_to_llvm_prebuilt(target: &str) -> String {
5653 // NOTE(RDambrosio016): currently disabled because of weird issues with segfaults and building the C++ shim
5754 // "x86_64-unknown-linux-gnu" => "linux-x86_64",
5855 _ => panic ! (
59- "Unsupported target with no matching prebuilt LLVM: `{}`, install LLVM and set LLVM_CONFIG" ,
60- target
56+ "Unsupported target with no matching prebuilt LLVM: `{target}`, install LLVM and set LLVM_CONFIG"
6157 ) ,
6258 } ;
63- format ! ( "{}.tar.xz" , base )
59+ format ! ( "{base }.tar.xz" )
6460}
6561
6662fn find_llvm_config ( target : & str ) -> PathBuf {
@@ -79,8 +75,7 @@ fn find_llvm_config(target: &str) -> PathBuf {
7975 return PathBuf :: from ( path_to_try) ;
8076 }
8177 println ! (
82- "cargo:warning=Prebuilt llvm-config version does not start with {}" ,
83- REQUIRED_MAJOR_LLVM_VERSION
78+ "cargo:warning=Prebuilt llvm-config version does not start with {REQUIRED_MAJOR_LLVM_VERSION}"
8479 ) ;
8580 } else {
8681 println ! ( "cargo:warning=Failed to run prebuilt llvm-config" ) ;
@@ -94,7 +89,7 @@ fn find_llvm_config(target: &str) -> PathBuf {
9489 . unwrap_or_else ( || PREBUILT_LLVM_URL . to_string ( ) ) ;
9590
9691 let prebuilt_name = target_to_llvm_prebuilt ( target) ;
97- url = format ! ( "{}{}" , url , prebuilt_name ) ;
92+ url = format ! ( "{url}{prebuilt_name}" ) ;
9893
9994 let out = env:: var ( "OUT_DIR" ) . expect ( "OUT_DIR was not set" ) ;
10095 let mut easy = Easy :: new ( ) ;
@@ -139,7 +134,7 @@ fn detect_llvm_link() -> (&'static str, &'static str) {
139134}
140135
141136pub fn tracked_env_var_os < K : AsRef < OsStr > + Display > ( key : K ) -> Option < OsString > {
142- println ! ( "cargo:rerun-if-env-changed={}" , key ) ;
137+ println ! ( "cargo:rerun-if-env-changed={key}" ) ;
143138 env:: var_os ( key)
144139}
145140
@@ -156,13 +151,12 @@ fn rustc_llvm_build() {
156151 for component in required_components {
157152 assert ! (
158153 components. contains( component) ,
159- "require llvm component {} but wasn't found" ,
160- component
154+ "require llvm component {component} but wasn't found"
161155 ) ;
162156 }
163157
164158 for component in components. iter ( ) {
165- println ! ( "cargo:rustc-cfg=llvm_component=\" {}\" " , component ) ;
159+ println ! ( "cargo:rustc-cfg=llvm_component=\" {component }\" " ) ;
166160 }
167161
168162 // Link in our own LLVM shims, compiled with the same flags as LLVM
@@ -255,7 +249,7 @@ fn rustc_llvm_build() {
255249 } else {
256250 "dylib"
257251 } ;
258- println ! ( "cargo:rustc-link-lib={}={}" , kind , name ) ;
252+ println ! ( "cargo:rustc-link-lib={kind }={name}" ) ;
259253 }
260254
261255 // Link in the system libraries that LLVM depends on
@@ -272,11 +266,11 @@ fn rustc_llvm_build() {
272266 cmd. arg ( llvm_link_arg) . arg ( "--ldflags" ) ;
273267 for lib in output ( & mut cmd) . split_whitespace ( ) {
274268 if let Some ( stripped) = lib. strip_prefix ( "-LIBPATH:" ) {
275- println ! ( "cargo:rustc-link-search=native={}" , stripped ) ;
269+ println ! ( "cargo:rustc-link-search=native={stripped}" ) ;
276270 } else if let Some ( stripped) = lib. strip_prefix ( "-l" ) {
277- println ! ( "cargo:rustc-link-lib={}" , stripped ) ;
271+ println ! ( "cargo:rustc-link-lib={stripped}" ) ;
278272 } else if let Some ( stripped) = lib. strip_prefix ( "-L" ) {
279- println ! ( "cargo:rustc-link-search=native={}" , stripped ) ;
273+ println ! ( "cargo:rustc-link-search=native={stripped}" ) ;
280274 }
281275 }
282276
@@ -288,9 +282,9 @@ fn rustc_llvm_build() {
288282 if let Some ( s) = llvm_linker_flags {
289283 for lib in s. into_string ( ) . unwrap ( ) . split_whitespace ( ) {
290284 if let Some ( stripped) = lib. strip_prefix ( "-l" ) {
291- println ! ( "cargo:rustc-link-lib={}" , stripped ) ;
285+ println ! ( "cargo:rustc-link-lib={stripped}" ) ;
292286 } else if let Some ( stripped) = lib. strip_prefix ( "-L" ) {
293- println ! ( "cargo:rustc-link-search=native={}" , stripped ) ;
287+ println ! ( "cargo:rustc-link-search=native={stripped}" ) ;
294288 }
295289 }
296290 }
@@ -330,14 +324,14 @@ fn rustc_llvm_build() {
330324 path. parent( ) . unwrap( ) . display( )
331325 ) ;
332326 if target. contains ( "windows" ) {
333- println ! ( "cargo:rustc-link-lib=static-nobundle={}" , stdcppname ) ;
327+ println ! ( "cargo:rustc-link-lib=static-nobundle={stdcppname}" ) ;
334328 } else {
335- println ! ( "cargo:rustc-link-lib=static={}" , stdcppname ) ;
329+ println ! ( "cargo:rustc-link-lib=static={stdcppname}" ) ;
336330 }
337331 } else if cxxflags. contains ( "stdlib=libc++" ) {
338332 println ! ( "cargo:rustc-link-lib=c++" ) ;
339333 } else {
340- println ! ( "cargo:rustc-link-lib={}" , stdcppname ) ;
334+ println ! ( "cargo:rustc-link-lib={stdcppname}" ) ;
341335 }
342336 }
343337
@@ -365,6 +359,6 @@ fn link_llvm_system_libs(llvm_config: &Path, components: &[&str]) {
365359 continue ;
366360 } ;
367361
368- println ! ( "cargo:rustc-link-lib=dylib={}" , name ) ;
362+ println ! ( "cargo:rustc-link-lib=dylib={name}" ) ;
369363 }
370364}
0 commit comments