run rustfmt on various folders
This commit is contained in:
@@ -25,7 +25,9 @@ pub fn run_silent(cmd: &mut Command) {
|
|||||||
};
|
};
|
||||||
if !status.success() {
|
if !status.success() {
|
||||||
fail(&format!("command did not execute successfully: {:?}\n\
|
fail(&format!("command did not execute successfully: {:?}\n\
|
||||||
expected success, got: {}", cmd, status));
|
expected success, got: {}",
|
||||||
|
cmd,
|
||||||
|
status));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +67,9 @@ pub fn output(cmd: &mut Command) -> String {
|
|||||||
};
|
};
|
||||||
if !output.status.success() {
|
if !output.status.success() {
|
||||||
panic!("command did not execute successfully: {:?}\n\
|
panic!("command did not execute successfully: {:?}\n\
|
||||||
expected success, got: {}", cmd, output.status);
|
expected success, got: {}",
|
||||||
|
cmd,
|
||||||
|
output.status);
|
||||||
}
|
}
|
||||||
String::from_utf8(output.stdout).unwrap()
|
String::from_utf8(output.stdout).unwrap()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,11 +57,7 @@ impl<T> RawVec<T> {
|
|||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
unsafe {
|
unsafe {
|
||||||
// !0 is usize::MAX. This branch should be stripped at compile time.
|
// !0 is usize::MAX. This branch should be stripped at compile time.
|
||||||
let cap = if mem::size_of::<T>() == 0 {
|
let cap = if mem::size_of::<T>() == 0 { !0 } else { 0 };
|
||||||
!0
|
|
||||||
} else {
|
|
||||||
0
|
|
||||||
};
|
|
||||||
|
|
||||||
// heap::EMPTY doubles as "unallocated" and "zero-sized allocation"
|
// heap::EMPTY doubles as "unallocated" and "zero-sized allocation"
|
||||||
RawVec {
|
RawVec {
|
||||||
@@ -209,11 +205,7 @@ impl<T> RawVec<T> {
|
|||||||
|
|
||||||
let (new_cap, ptr) = if self.cap == 0 {
|
let (new_cap, ptr) = if self.cap == 0 {
|
||||||
// skip to 4 because tiny Vec's are dumb; but not if that would cause overflow
|
// skip to 4 because tiny Vec's are dumb; but not if that would cause overflow
|
||||||
let new_cap = if elem_size > (!0) / 8 {
|
let new_cap = if elem_size > (!0) / 8 { 1 } else { 4 };
|
||||||
1
|
|
||||||
} else {
|
|
||||||
4
|
|
||||||
};
|
|
||||||
let ptr = heap::allocate(new_cap * elem_size, align);
|
let ptr = heap::allocate(new_cap * elem_size, align);
|
||||||
(new_cap, ptr)
|
(new_cap, ptr)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -35,12 +35,8 @@ fn main() {
|
|||||||
// that the feature set used by std is the same across all
|
// that the feature set used by std is the same across all
|
||||||
// targets, which means we have to build the alloc_jemalloc crate
|
// targets, which means we have to build the alloc_jemalloc crate
|
||||||
// for targets like emscripten, even if we don't use it.
|
// for targets like emscripten, even if we don't use it.
|
||||||
if target.contains("rumprun") ||
|
if target.contains("rumprun") || target.contains("bitrig") || target.contains("openbsd") ||
|
||||||
target.contains("bitrig") ||
|
target.contains("msvc") || target.contains("emscripten") {
|
||||||
target.contains("openbsd") ||
|
|
||||||
target.contains("msvc") ||
|
|
||||||
target.contains("emscripten")
|
|
||||||
{
|
|
||||||
println!("cargo:rustc-cfg=dummy_jemalloc");
|
println!("cargo:rustc-cfg=dummy_jemalloc");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -221,11 +221,7 @@ mod imp {
|
|||||||
HEAP_REALLOC_IN_PLACE_ONLY,
|
HEAP_REALLOC_IN_PLACE_ONLY,
|
||||||
ptr as LPVOID,
|
ptr as LPVOID,
|
||||||
size as SIZE_T) as *mut u8;
|
size as SIZE_T) as *mut u8;
|
||||||
if new.is_null() {
|
if new.is_null() { old_size } else { size }
|
||||||
old_size
|
|
||||||
} else {
|
|
||||||
size
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
old_size
|
old_size
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -302,9 +302,8 @@ mod tests {
|
|||||||
|
|
||||||
let arena = Wrap(TypedArena::new());
|
let arena = Wrap(TypedArena::new());
|
||||||
|
|
||||||
let result = arena.alloc_outer(|| {
|
let result =
|
||||||
Outer { inner: arena.alloc_inner(|| Inner { value: 10 }) }
|
arena.alloc_outer(|| Outer { inner: arena.alloc_inner(|| Inner { value: 10 }) });
|
||||||
});
|
|
||||||
|
|
||||||
assert_eq!(result.inner.value, 10);
|
assert_eq!(result.inner.value, 10);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user