Skip to content

Commit

Permalink
rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
nnethercote committed Dec 20, 2021
1 parent eb38ed2 commit ff1deb3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 21 deletions.
20 changes: 11 additions & 9 deletions tests/ad-hoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 16,13 @@ fn main() {
use serde_json::Value::{self, *};

let mem = {
let mut profiler = std::mem::ManuallyDrop::new(dhat::Profiler::builder()
.ad_hoc()
.trim_backtraces(Some(usize::MAX))
.eprint_json()
.build());
let mut profiler = std::mem::ManuallyDrop::new(
dhat::Profiler::builder()
.ad_hoc()
.trim_backtraces(Some(usize::MAX))
.eprint_json()
.build(),
);

let stats = dhat::AdHocStats::get();
assert_eq!(stats.total_events, 0);
Expand Down Expand Up @@ -134,15 136,15 @@ fn main() {
assert!(y("ad_hoc::f2 (dhat-rs\\tests\\ad-hoc.rs:6:0)"));
//assert!(y("ad_hoc::f1 (dhat-rs\\tests\\ad-hoc.rs:10:0)"));
assert!(y("ad_hoc::f1 (dhat-rs\\tests\\ad-hoc.rs:11:0)"));
assert!(y("ad_hoc::main (dhat-rs\\tests\\ad-hoc.rs:29:0)"));
//assert!(y("ad_hoc::main (dhat-rs\\tests\\ad-hoc.rs:30:0)"));
assert!(y("ad_hoc::main (dhat-rs\\tests\\ad-hoc.rs:31:0)"));
//assert!(y("ad_hoc::main (dhat-rs\\tests\\ad-hoc.rs:32:0)"));
} else {
assert!(y("ad_hoc::f2 (dhat-rs/tests/ad-hoc.rs:5:5)"));
assert!(y("ad_hoc::f2 (dhat-rs/tests/ad-hoc.rs:6:5)"));
assert!(y("ad_hoc::f1 (dhat-rs/tests/ad-hoc.rs:10:5)"));
assert!(y("ad_hoc::f1 (dhat-rs/tests/ad-hoc.rs:11:5)"));
assert!(y("ad_hoc::main (dhat-rs/tests/ad-hoc.rs:29:9)"));
assert!(y("ad_hoc::main (dhat-rs/tests/ad-hoc.rs:30:9)"));
assert!(y("ad_hoc::main (dhat-rs/tests/ad-hoc.rs:31:9)"));
assert!(y("ad_hoc::main (dhat-rs/tests/ad-hoc.rs:32:9)"));
}

// This stuff should be removed by backtrace trimming.
Expand Down
26 changes: 14 additions & 12 deletions tests/heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 12,12 @@ fn main() {
let mut v4 = vec![1u32, 2, 3, 4];

let mem = {
let mut profiler = std::mem::ManuallyDrop::new(dhat::Profiler::builder()
.trim_backtraces(Some(usize::MAX))
.eprint_json()
.build());
let mut profiler = std::mem::ManuallyDrop::new(
dhat::Profiler::builder()
.trim_backtraces(Some(usize::MAX))
.eprint_json()
.build(),
);

// Things allocated beforehand aren't counted.
let stats = dhat::HeapStats::get();
Expand Down Expand Up @@ -164,21 166,21 @@ fn main() {
assert!(y(
"alloc::vec::Vec<u32,alloc::alloc::Global>::reserve<u32,alloc::alloc::Global>"
));
assert!(y("heap::main (dhat-rs\\tests\\heap.rs:33:0)")); // v3
assert!(y("heap::main (dhat-rs\\tests\\heap.rs:36:0)")); // v5
assert!(y("heap::main (dhat-rs\\tests\\heap.rs:37:0)")); // v6
assert!(y("heap::main (dhat-rs\\tests\\heap.rs:47:0)")); // _v7
assert!(y("heap::main (dhat-rs\\tests\\heap.rs:35:0)")); // v3
assert!(y("heap::main (dhat-rs\\tests\\heap.rs:38:0)")); // v5
assert!(y("heap::main (dhat-rs\\tests\\heap.rs:39:0)")); // v6
assert!(y("heap::main (dhat-rs\\tests\\heap.rs:49:0)")); // _v7
} else {
// Stack traces are terrible in Windows release builds.
assert!(y("RawVec"));
}
} else {
assert!(y("alloc::vec::Vec<T,A>::push"));
assert!(y("alloc::vec::Vec<T,A>::reserve"));
assert!(y("heap::main (dhat-rs/tests/heap.rs:33:9)")); // v3
assert!(y("heap::main (dhat-rs/tests/heap.rs:36:18)")); // v5
assert!(y("heap::main (dhat-rs/tests/heap.rs:37:22)")); // v6
assert!(y("heap::main (dhat-rs/tests/heap.rs:47:22)")); // _v7
assert!(y("heap::main (dhat-rs/tests/heap.rs:35:9)")); // v3
assert!(y("heap::main (dhat-rs/tests/heap.rs:38:18)")); // v5
assert!(y("heap::main (dhat-rs/tests/heap.rs:39:22)")); // v6
assert!(y("heap::main (dhat-rs/tests/heap.rs:49:22)")); // _v7
}

// This stuff should be removed by backtrace trimming.
Expand Down

0 comments on commit ff1deb3

Please sign in to comment.