Skip to content

Commit

Permalink
tests: fix fallout from empowering unused_allocation in comparisons.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb committed Jun 1, 2017
1 parent 3ce4438 commit 58632f3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions src/libcollections/tests/binary_heap.rs
Expand Up @@ -134,22 +134,22 @@ fn test_push() {
fn test_push_unique() {
let mut heap = BinaryHeap::<Box<_>>::from(vec![box 2, box 4, box 9]);
assert_eq!(heap.len(), 3);
assert!(*heap.peek().unwrap() == box 9);
assert!(**heap.peek().unwrap() == 9);
heap.push(box 11);
assert_eq!(heap.len(), 4);
assert!(*heap.peek().unwrap() == box 11);
assert!(**heap.peek().unwrap() == 11);
heap.push(box 5);
assert_eq!(heap.len(), 5);
assert!(*heap.peek().unwrap() == box 11);
assert!(**heap.peek().unwrap() == 11);
heap.push(box 27);
assert_eq!(heap.len(), 6);
assert!(*heap.peek().unwrap() == box 27);
assert!(**heap.peek().unwrap() == 27);
heap.push(box 3);
assert_eq!(heap.len(), 7);
assert!(*heap.peek().unwrap() == box 27);
assert!(**heap.peek().unwrap() == 27);
heap.push(box 103);
assert_eq!(heap.len(), 8);
assert!(*heap.peek().unwrap() == box 103);
assert!(**heap.peek().unwrap() == 103);
}

fn check_to_vec(mut data: Vec<i32>) {
Expand Down
20 changes: 10 additions & 10 deletions src/libstd/sync/mpsc/mod.rs
Expand Up @@ -1924,7 +1924,7 @@ mod tests {
fn oneshot_single_thread_send_then_recv() {
let (tx, rx) = channel::<Box<i32>>();
tx.send(box 10).unwrap();
assert!(rx.recv().unwrap() == box 10);
assert!(*rx.recv().unwrap() == 10);
}

#[test]
Expand Down Expand Up @@ -1981,7 +1981,7 @@ mod tests {
fn oneshot_multi_task_recv_then_send() {
let (tx, rx) = channel::<Box<i32>>();
let _t = thread::spawn(move|| {
assert!(rx.recv().unwrap() == box 10);
assert!(*rx.recv().unwrap() == 10);
});

tx.send(box 10).unwrap();
Expand All @@ -1994,7 +1994,7 @@ mod tests {
drop(tx);
});
let res = thread::spawn(move|| {
assert!(rx.recv().unwrap() == box 10);
assert!(*rx.recv().unwrap() == 10);
}).join();
assert!(res.is_err());
}
Expand Down Expand Up @@ -2048,7 +2048,7 @@ mod tests {
let _t = thread::spawn(move|| {
tx.send(box 10).unwrap();
});
assert!(rx.recv().unwrap() == box 10);
assert!(*rx.recv().unwrap() == 10);
}
}

Expand All @@ -2073,7 +2073,7 @@ mod tests {
if i == 10 { return }

thread::spawn(move|| {
assert!(rx.recv().unwrap() == box i);
assert!(*rx.recv().unwrap() == i);
recv(rx, i + 1);
});
}
Expand Down Expand Up @@ -2610,7 +2610,7 @@ mod sync_tests {
fn oneshot_single_thread_send_then_recv() {
let (tx, rx) = sync_channel::<Box<i32>>(1);
tx.send(box 10).unwrap();
assert!(rx.recv().unwrap() == box 10);
assert!(*rx.recv().unwrap() == 10);
}

#[test]
Expand Down Expand Up @@ -2682,7 +2682,7 @@ mod sync_tests {
fn oneshot_multi_task_recv_then_send() {
let (tx, rx) = sync_channel::<Box<i32>>(0);
let _t = thread::spawn(move|| {
assert!(rx.recv().unwrap() == box 10);
assert!(*rx.recv().unwrap() == 10);
});

tx.send(box 10).unwrap();
Expand All @@ -2695,7 +2695,7 @@ mod sync_tests {
drop(tx);
});
let res = thread::spawn(move|| {
assert!(rx.recv().unwrap() == box 10);
assert!(*rx.recv().unwrap() == 10);
}).join();
assert!(res.is_err());
}
Expand Down Expand Up @@ -2749,7 +2749,7 @@ mod sync_tests {
let _t = thread::spawn(move|| {
tx.send(box 10).unwrap();
});
assert!(rx.recv().unwrap() == box 10);
assert!(*rx.recv().unwrap() == 10);
}
}

Expand All @@ -2774,7 +2774,7 @@ mod sync_tests {
if i == 10 { return }

thread::spawn(move|| {
assert!(rx.recv().unwrap() == box i);
assert!(*rx.recv().unwrap() == i);
recv(rx, i + 1);
});
}
Expand Down

0 comments on commit 58632f3

Please sign in to comment.