Skip to content

Commit 366ca44

Browse files
committed
std: silence some test warnings.
1 parent d8087ca commit 366ca44

File tree

6 files changed

+22
-27
lines changed

6 files changed

+22
-27
lines changed

src/libstd/iterator.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,6 @@ mod tests {
980980
use super::*;
981981
use prelude::*;
982982

983-
use iter;
984983
use uint;
985984

986985
#[test]

src/libstd/local_data.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,12 @@ fn test_tls_multitask() {
9292
fn my_key(_x: @~str) { }
9393
local_data_set(my_key, @~"parent data");
9494
do task::spawn {
95-
unsafe {
96-
// TLS shouldn't carry over.
97-
assert!(local_data_get(my_key).is_none());
98-
local_data_set(my_key, @~"child data");
99-
assert!(*(local_data_get(my_key).get()) ==
95+
// TLS shouldn't carry over.
96+
assert!(local_data_get(my_key).is_none());
97+
local_data_set(my_key, @~"child data");
98+
assert!(*(local_data_get(my_key).get()) ==
10099
~"child data");
101-
// should be cleaned up for us
102-
}
100+
// should be cleaned up for us
103101
}
104102
// Must work multiple times
105103
assert!(*(local_data_get(my_key).get()) == ~"parent data");
@@ -206,12 +204,11 @@ fn test_tls_cleanup_on_failure() {
206204
local_data_set(str_key, @~"parent data");
207205
local_data_set(box_key, @@());
208206
do task::spawn {
209-
unsafe { // spawn_linked
210-
local_data_set(str_key, @~"string data");
211-
local_data_set(box_key, @@());
212-
local_data_set(int_key, @42);
213-
fail!();
214-
}
207+
// spawn_linked
208+
local_data_set(str_key, @~"string data");
209+
local_data_set(box_key, @@());
210+
local_data_set(int_key, @42);
211+
fail!();
215212
}
216213
// Not quite nondeterministic.
217214
local_data_set(int_key, @31337);

src/libstd/rt/uv/timer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,14 @@ mod test {
160160
let mut timer2 = TimerWatcher::new(&mut loop_);
161161
do timer2.start(10, 0) |timer2, _| {
162162

163-
unsafe { *count_ptr += 1; }
163+
*count_ptr += 1;
164164

165165
timer2.close(||());
166166

167167
// Restart the original timer
168168
let mut timer = timer;
169169
do timer.start(1, 0) |timer, _| {
170-
unsafe { *count_ptr += 1; }
170+
*count_ptr += 1;
171171
timer.close(||());
172172
}
173173
}

src/libstd/str.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2249,7 +2249,7 @@ mod tests {
22492249
assert!("" <= "");
22502250
assert!("" <= "foo");
22512251
assert!("foo" <= "foo");
2252-
assert!("foo" != ~"bar");
2252+
assert!("foo" != "bar");
22532253
}
22542254
22552255
#[test]
@@ -3156,6 +3156,7 @@ mod tests {
31563156
31573157
#[test]
31583158
fn test_add() {
3159+
#[allow(unnecessary_allocation)];
31593160
macro_rules! t (
31603161
($s1:expr, $s2:expr, $e:expr) => {
31613162
assert_eq!($s1 + $s2, $e);

src/libstd/task/mod.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -934,17 +934,15 @@ fn test_spawn_sched_blocking() {
934934
let lock = testrt::rust_dbg_lock_create();
935935

936936
do spawn_sched(SingleThreaded) {
937-
unsafe {
938-
testrt::rust_dbg_lock_lock(lock);
937+
testrt::rust_dbg_lock_lock(lock);
939938

940-
start_ch.send(());
939+
start_ch.send(());
941940

942-
// Block the scheduler thread
943-
testrt::rust_dbg_lock_wait(lock);
944-
testrt::rust_dbg_lock_unlock(lock);
941+
// Block the scheduler thread
942+
testrt::rust_dbg_lock_wait(lock);
943+
testrt::rust_dbg_lock_unlock(lock);
945944

946-
fin_ch.send(());
947-
}
945+
fin_ch.send(());
948946
};
949947

950948
// Wait until the other task has its lock

src/libstd/vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3861,11 +3861,11 @@ mod tests {
38613861
fn test_vec_zero() {
38623862
use num::Zero;
38633863
macro_rules! t (
3864-
($ty:ty) => {
3864+
($ty:ty) => {{
38653865
let v: $ty = Zero::zero();
38663866
assert!(v.is_empty());
38673867
assert!(v.is_zero());
3868-
}
3868+
}}
38693869
);
38703870

38713871
t!(&[int]);

0 commit comments

Comments
 (0)