33extern crate build_common;
44
55use build_common:: generate_and_configure_header;
6+ use std:: env;
67
78fn main ( ) {
8- let header_name = "otel-thread-ctx.h" ;
9- generate_and_configure_header ( header_name) ;
10-
11- let target_os = std:: env:: var ( "CARGO_CFG_TARGET_OS" ) . unwrap ( ) ;
9+ generate_and_configure_header ( "otel-thread-ctx.h" ) ;
10+ let target_os = env:: var ( "CARGO_CFG_TARGET_OS" ) . unwrap ( ) ;
1211
1312 // Export the TLSDESC thread-local variable to the dynamic symbol table so
1413 // external readers (e.g. the eBPF profiler) can locate it. Rust's cdylib
@@ -21,7 +20,7 @@ fn main() {
2120 // Merging multiple version scripts is not supported by GNU ld, so we also
2221 // force lld explicitly.
2322 if target_os == "linux" {
24- let manifest_dir = std :: env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ;
23+ let manifest_dir = env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ;
2524 println ! ( "cargo:rustc-cdylib-link-arg=-fuse-ld=lld" ) ;
2625 println ! (
2726 "cargo:rustc-cdylib-link-arg=-Wl,--version-script={manifest_dir}/tls-dynamic-list.txt"
@@ -31,8 +30,7 @@ fn main() {
3130 // locate the cdylib without fragile path-walking.
3231 // OUT_DIR = <target>/[<triple>/]<profile>/build/<pkg>-<hash>/out
3332 // Three levels up lands on <target>/[<triple>/]<profile>.
34- let out_dir = std:: env:: var ( "OUT_DIR" ) . unwrap ( ) ;
35- let profile_dir = std:: path:: PathBuf :: from ( & out_dir)
33+ let profile_dir = std:: path:: PathBuf :: from ( & env:: var ( "OUT_DIR" ) . unwrap ( ) )
3634 . ancestors ( )
3735 . nth ( 3 )
3836 . unwrap ( )
0 commit comments