about summary refs log tree commit diff
diff options
context:
space:
mode:
authorHuon Wilson <dbau.pp+github@gmail.com>2013-06-28 01:45:24 +1000
committerHuon Wilson <dbau.pp+github@gmail.com>2013-06-28 01:45:24 +1000
commit366ca44cc8f79704f8781adb15e74d3c2a0e5572 (patch)
treed6a616077f56aa66c7b98142db0584f104c9ea08
parentd8087cae442ba3ca5070c7f3865e798f3786d28c (diff)
downloadrust-366ca44cc8f79704f8781adb15e74d3c2a0e5572.tar.gz
rust-366ca44cc8f79704f8781adb15e74d3c2a0e5572.zip
std: silence some test warnings.
-rw-r--r--src/libstd/iterator.rs1
-rw-r--r--src/libstd/local_data.rs23
-rw-r--r--src/libstd/rt/uv/timer.rs4
-rw-r--r--src/libstd/str.rs3
-rw-r--r--src/libstd/task/mod.rs14
-rw-r--r--src/libstd/vec.rs4
6 files changed, 22 insertions, 27 deletions
diff --git a/src/libstd/iterator.rs b/src/libstd/iterator.rs
index ab433a9a79d..7de02a9f815 100644
--- a/src/libstd/iterator.rs
+++ b/src/libstd/iterator.rs
@@ -980,7 +980,6 @@ mod tests {
     use super::*;
     use prelude::*;
 
-    use iter;
     use uint;
 
     #[test]
diff --git a/src/libstd/local_data.rs b/src/libstd/local_data.rs
index 82c01c998cf..33b4e3f1963 100644
--- a/src/libstd/local_data.rs
+++ b/src/libstd/local_data.rs
@@ -92,14 +92,12 @@ fn test_tls_multitask() {
         fn my_key(_x: @~str) { }
         local_data_set(my_key, @~"parent data");
         do task::spawn {
-            unsafe {
-                // TLS shouldn't carry over.
-                assert!(local_data_get(my_key).is_none());
-                local_data_set(my_key, @~"child data");
-                assert!(*(local_data_get(my_key).get()) ==
+            // TLS shouldn't carry over.
+            assert!(local_data_get(my_key).is_none());
+            local_data_set(my_key, @~"child data");
+            assert!(*(local_data_get(my_key).get()) ==
                     ~"child data");
-                // should be cleaned up for us
-            }
+            // should be cleaned up for us
         }
         // Must work multiple times
         assert!(*(local_data_get(my_key).get()) == ~"parent data");
@@ -206,12 +204,11 @@ fn test_tls_cleanup_on_failure() {
         local_data_set(str_key, @~"parent data");
         local_data_set(box_key, @@());
         do task::spawn {
-            unsafe { // spawn_linked
-                local_data_set(str_key, @~"string data");
-                local_data_set(box_key, @@());
-                local_data_set(int_key, @42);
-                fail!();
-            }
+            // spawn_linked
+            local_data_set(str_key, @~"string data");
+            local_data_set(box_key, @@());
+            local_data_set(int_key, @42);
+            fail!();
         }
         // Not quite nondeterministic.
         local_data_set(int_key, @31337);
diff --git a/src/libstd/rt/uv/timer.rs b/src/libstd/rt/uv/timer.rs
index cd6fc5c0a25..14465eb7dfd 100644
--- a/src/libstd/rt/uv/timer.rs
+++ b/src/libstd/rt/uv/timer.rs
@@ -160,14 +160,14 @@ mod test {
                         let mut timer2 = TimerWatcher::new(&mut loop_);
                         do timer2.start(10, 0) |timer2, _| {
 
-                            unsafe { *count_ptr += 1; }
+                            *count_ptr += 1;
 
                             timer2.close(||());
 
                             // Restart the original timer
                             let mut timer = timer;
                             do timer.start(1, 0) |timer, _| {
-                                unsafe { *count_ptr += 1; }
+                                *count_ptr += 1;
                                 timer.close(||());
                             }
                         }
diff --git a/src/libstd/str.rs b/src/libstd/str.rs
index 58cdc6631f0..b4292a30541 100644
--- a/src/libstd/str.rs
+++ b/src/libstd/str.rs
@@ -2249,7 +2249,7 @@ mod tests {
         assert!("" <= "");
         assert!("" <= "foo");
         assert!("foo" <= "foo");
-        assert!("foo" != ~"bar");
+        assert!("foo" != "bar");
     }
 
     #[test]
@@ -3156,6 +3156,7 @@ mod tests {
 
     #[test]
     fn test_add() {
+        #[allow(unnecessary_allocation)];
         macro_rules! t (
             ($s1:expr, $s2:expr, $e:expr) => {
                 assert_eq!($s1 + $s2, $e);
diff --git a/src/libstd/task/mod.rs b/src/libstd/task/mod.rs
index 223afbce091..b558b9d53a3 100644
--- a/src/libstd/task/mod.rs
+++ b/src/libstd/task/mod.rs
@@ -934,17 +934,15 @@ fn test_spawn_sched_blocking() {
             let lock = testrt::rust_dbg_lock_create();
 
             do spawn_sched(SingleThreaded) {
-                unsafe {
-                    testrt::rust_dbg_lock_lock(lock);
+                testrt::rust_dbg_lock_lock(lock);
 
-                    start_ch.send(());
+                start_ch.send(());
 
-                    // Block the scheduler thread
-                    testrt::rust_dbg_lock_wait(lock);
-                    testrt::rust_dbg_lock_unlock(lock);
+                // Block the scheduler thread
+                testrt::rust_dbg_lock_wait(lock);
+                testrt::rust_dbg_lock_unlock(lock);
 
-                    fin_ch.send(());
-                }
+                fin_ch.send(());
             };
 
             // Wait until the other task has its lock
diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs
index 5dfea811c23..8cbd9309cc6 100644
--- a/src/libstd/vec.rs
+++ b/src/libstd/vec.rs
@@ -3861,11 +3861,11 @@ mod tests {
     fn test_vec_zero() {
         use num::Zero;
         macro_rules! t (
-            ($ty:ty) => {
+            ($ty:ty) => {{
                 let v: $ty = Zero::zero();
                 assert!(v.is_empty());
                 assert!(v.is_zero());
-            }
+            }}
         );
 
         t!(&[int]);