From adf2c432dcd3e121ccbd3904c92252b51aa110a5 Mon Sep 17 00:00:00 2001 From: Srinivas Reddy Thatiparthy Date: Sun, 5 Jun 2016 11:39:17 +0530 Subject: [PATCH] run rustfmt on liballoc_jemalloc folder --- src/liballoc_jemalloc/build.rs | 29 ++++++++++++++++++++--------- src/liballoc_jemalloc/lib.rs | 11 ++++++----- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/liballoc_jemalloc/build.rs b/src/liballoc_jemalloc/build.rs index 33a675331ab..e43b9a9df1b 100644 --- a/src/liballoc_jemalloc/build.rs +++ b/src/liballoc_jemalloc/build.rs @@ -33,18 +33,26 @@ fn main() { jemalloc.parent().unwrap().display()); let stem = jemalloc.file_stem().unwrap().to_str().unwrap(); let name = jemalloc.file_name().unwrap().to_str().unwrap(); - let kind = if name.ends_with(".a") {"static"} else {"dylib"}; + let kind = if name.ends_with(".a") { + "static" + } else { + "dylib" + }; println!("cargo:rustc-link-lib={}={}", kind, &stem[3..]); - return + return; } let compiler = gcc::Config::new().get_compiler(); let ar = build_helper::cc2ar(compiler.path(), &target); - let cflags = compiler.args().iter().map(|s| s.to_str().unwrap()) - .collect::>().join(" "); + let cflags = compiler.args() + .iter() + .map(|s| s.to_str().unwrap()) + .collect::>() + .join(" "); let mut stack = src_dir.join("../jemalloc") - .read_dir().unwrap() + .read_dir() + .unwrap() .map(|e| e.unwrap()) .collect::>(); while let Some(entry) = stack.pop() { @@ -57,7 +65,9 @@ fn main() { } let mut cmd = Command::new("sh"); - cmd.arg(src_dir.join("../jemalloc/configure").to_str().unwrap() + cmd.arg(src_dir.join("../jemalloc/configure") + .to_str() + .unwrap() .replace("C:\\", "/c/") .replace("\\", "/")) .current_dir(&build_dir) @@ -117,9 +127,10 @@ fn main() { run(&mut cmd); run(Command::new("make") - .current_dir(&build_dir) - .arg("build_lib_static") - .arg("-j").arg(env::var("NUM_JOBS").unwrap())); + .current_dir(&build_dir) + .arg("build_lib_static") + .arg("-j") + .arg(env::var("NUM_JOBS").unwrap())); if target.contains("windows") { println!("cargo:rustc-link-lib=static=jemalloc"); diff --git a/src/liballoc_jemalloc/lib.rs b/src/liballoc_jemalloc/lib.rs index 7651d91c06d..347e97e6ffc 100644 --- a/src/liballoc_jemalloc/lib.rs +++ b/src/liballoc_jemalloc/lib.rs @@ -39,12 +39,12 @@ use libc::{c_int, c_void, size_t}; not(target_env = "musl")), link(name = "pthread"))] #[cfg(not(cargobuild))] -extern {} +extern "C" {} // Note that the symbols here are prefixed by default on OSX and Windows (we // don't explicitly request it), and on Android and DragonFly we explicitly // request it as unprefixing cause segfaults (mismatches in allocators). -extern { +extern "C" { #[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios", target_os = "dragonfly", target_os = "windows"), link_name = "je_mallocx")] @@ -136,8 +136,9 @@ pub extern "C" fn __rust_usable_size(size: usize, align: usize) -> usize { // are available. #[no_mangle] #[cfg(target_os = "android")] -pub extern fn pthread_atfork(_prefork: *mut u8, - _postfork_parent: *mut u8, - _postfork_child: *mut u8) -> i32 { +pub extern "C" fn pthread_atfork(_prefork: *mut u8, + _postfork_parent: *mut u8, + _postfork_child: *mut u8) + -> i32 { 0 }