Skip to content

Commit adf2c43

Browse files
committed
run rustfmt on liballoc_jemalloc folder
1 parent 382ab92 commit adf2c43

File tree

2 files changed

+26
-14
lines changed

2 files changed

+26
-14
lines changed

src/liballoc_jemalloc/build.rs

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,26 @@ fn main() {
3333
jemalloc.parent().unwrap().display());
3434
let stem = jemalloc.file_stem().unwrap().to_str().unwrap();
3535
let name = jemalloc.file_name().unwrap().to_str().unwrap();
36-
let kind = if name.ends_with(".a") {"static"} else {"dylib"};
36+
let kind = if name.ends_with(".a") {
37+
"static"
38+
} else {
39+
"dylib"
40+
};
3741
println!("cargo:rustc-link-lib={}={}", kind, &stem[3..]);
38-
return
42+
return;
3943
}
4044

4145
let compiler = gcc::Config::new().get_compiler();
4246
let ar = build_helper::cc2ar(compiler.path(), &target);
43-
let cflags = compiler.args().iter().map(|s| s.to_str().unwrap())
44-
.collect::<Vec<_>>().join(" ");
47+
let cflags = compiler.args()
48+
.iter()
49+
.map(|s| s.to_str().unwrap())
50+
.collect::<Vec<_>>()
51+
.join(" ");
4552

4653
let mut stack = src_dir.join("../jemalloc")
47-
.read_dir().unwrap()
54+
.read_dir()
55+
.unwrap()
4856
.map(|e| e.unwrap())
4957
.collect::<Vec<_>>();
5058
while let Some(entry) = stack.pop() {
@@ -57,7 +65,9 @@ fn main() {
5765
}
5866

5967
let mut cmd = Command::new("sh");
60-
cmd.arg(src_dir.join("../jemalloc/configure").to_str().unwrap()
68+
cmd.arg(src_dir.join("../jemalloc/configure")
69+
.to_str()
70+
.unwrap()
6171
.replace("C:\\", "/c/")
6272
.replace("\\", "/"))
6373
.current_dir(&build_dir)
@@ -117,9 +127,10 @@ fn main() {
117127

118128
run(&mut cmd);
119129
run(Command::new("make")
120-
.current_dir(&build_dir)
121-
.arg("build_lib_static")
122-
.arg("-j").arg(env::var("NUM_JOBS").unwrap()));
130+
.current_dir(&build_dir)
131+
.arg("build_lib_static")
132+
.arg("-j")
133+
.arg(env::var("NUM_JOBS").unwrap()));
123134

124135
if target.contains("windows") {
125136
println!("cargo:rustc-link-lib=static=jemalloc");

src/liballoc_jemalloc/lib.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ use libc::{c_int, c_void, size_t};
3939
not(target_env = "musl")),
4040
link(name = "pthread"))]
4141
#[cfg(not(cargobuild))]
42-
extern {}
42+
extern "C" {}
4343

4444
// Note that the symbols here are prefixed by default on OSX and Windows (we
4545
// don't explicitly request it), and on Android and DragonFly we explicitly
4646
// request it as unprefixing cause segfaults (mismatches in allocators).
47-
extern {
47+
extern "C" {
4848
#[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios",
4949
target_os = "dragonfly", target_os = "windows"),
5050
link_name = "je_mallocx")]
@@ -136,8 +136,9 @@ pub extern "C" fn __rust_usable_size(size: usize, align: usize) -> usize {
136136
// are available.
137137
#[no_mangle]
138138
#[cfg(target_os = "android")]
139-
pub extern fn pthread_atfork(_prefork: *mut u8,
140-
_postfork_parent: *mut u8,
141-
_postfork_child: *mut u8) -> i32 {
139+
pub extern "C" fn pthread_atfork(_prefork: *mut u8,
140+
_postfork_parent: *mut u8,
141+
_postfork_child: *mut u8)
142+
-> i32 {
142143
0
143144
}

0 commit comments

Comments
 (0)