about summary refs log tree commit diff
path: root/src/libsync/deque.rs
diff options
context:
space:
mode:
authorNODA, Kai <nodakai@gmail.com>2014-10-05 18:11:17 +0800
committerNODA, Kai <nodakai@gmail.com>2014-10-13 14:16:22 +0800
commitf27ad3d3e99ce679f782607971a9f6f18befa503 (patch)
tree388f850cfb1e4d06077dfa6cd28a0e79eda28c07 /src/libsync/deque.rs
parenta6e0c76ef4b8ed87698dc9fe51e952039d33b913 (diff)
Clean up rustc warnings.
compiletest: compact "linux" "macos" etc.as "unix".
liballoc: remove a superfluous "use".
libcollections: remove invocations of deprecated methods in favor of
    their suggested replacements and use "_" for a loop counter.
libcoretest: remove invocations of deprecated methods;  also add
    "allow(deprecated)" for testing a deprecated method itself.
libglob: use "cfg_attr".
libgraphviz: add a test for one of data constructors.
libgreen: remove a superfluous "use".
libnum: "allow(type_overflow)" for type cast into u8 in a test code.
librustc: names of static variables should be in upper case.
libserialize: v[i] instead of get().
libstd/ascii: to_lowercase() instead of to_lower().
libstd/bitflags: modify AnotherSetOfFlags to use i8 as its backend.
    It will serve better for testing various aspects of bitflags!.
libstd/collections: "allow(deprecated)" for testing a deprecated
    method itself.
libstd/io: remove invocations of deprecated methods and superfluous "use".
    Also add #[test] where it was missing.
libstd/num: introduce a helper function to effectively remove
    invocations of a deprecated method.
libstd/path and rand: remove invocations of deprecated methods and
    superfluous "use".
libstd/task and libsync/comm: "allow(deprecated)" for testing
    a deprecated method itself.
libsync/deque: remove superfluous "unsafe".
libsync/mutex and once: names of static variables should be in upper case.
libterm: introduce a helper function to effectively remove
    invocations of a deprecated method.

We still see a few warnings about using obsoleted native::task::spawn()
in the test modules for libsync.  I'm not sure how I should replace them
with std::task::TaksBuilder and native::task::NativeTaskBuilder
(dependency to libstd?)

Signed-off-by: NODA, Kai <nodakai@gmail.com>
Diffstat (limited to 'src/libsync/deque.rs')
-rw-r--r--src/libsync/deque.rs34
1 files changed, 15 insertions, 19 deletions
diff --git a/src/libsync/deque.rs b/src/libsync/deque.rs
index 33881629329..09fa8920a07 100644
--- a/src/libsync/deque.rs
+++ b/src/libsync/deque.rs
@@ -553,14 +553,12 @@ mod tests {
         let threads = range(0, NTHREADS).map(|_| {
             let s = s.clone();
             Thread::start(proc() {
-                unsafe {
-                    loop {
-                        match s.steal() {
-                            Data(2) => { HITS.fetch_add(1, SeqCst); }
-                            Data(..) => fail!(),
-                            _ if DONE.load(SeqCst) => break,
-                            _ => {}
-                        }
+                loop {
+                    match s.steal() {
+                        Data(2) => { HITS.fetch_add(1, SeqCst); }
+                        Data(..) => fail!(),
+                        _ if DONE.load(SeqCst) => break,
+                        _ => {}
                     }
                 }
             })
@@ -572,7 +570,7 @@ mod tests {
             if rng.gen_range(0i, 3) == 2 {
                 match w.pop() {
                     None => {}
-                    Some(2) => unsafe { HITS.fetch_add(1, SeqCst); },
+                    Some(2) => { HITS.fetch_add(1, SeqCst); },
                     Some(_) => fail!(),
                 }
             } else {
@@ -581,22 +579,20 @@ mod tests {
             }
         }
 
-        unsafe {
-            while HITS.load(SeqCst) < AMT as uint {
-                match w.pop() {
-                    None => {}
-                    Some(2) => { HITS.fetch_add(1, SeqCst); },
-                    Some(_) => fail!(),
-                }
+        while HITS.load(SeqCst) < AMT as uint {
+            match w.pop() {
+                None => {}
+                Some(2) => { HITS.fetch_add(1, SeqCst); },
+                Some(_) => fail!(),
             }
-            DONE.store(true, SeqCst);
         }
+        DONE.store(true, SeqCst);
 
         for thread in threads.into_iter() {
             thread.join();
         }
 
-        assert_eq!(unsafe { HITS.load(SeqCst) }, expected as uint);
+        assert_eq!(HITS.load(SeqCst), expected as uint);
     }
 
     #[test]
@@ -655,7 +651,7 @@ mod tests {
             }
         }
 
-        unsafe { DONE.store(true, SeqCst); }
+        DONE.store(true, SeqCst);
 
         for thread in threads.into_iter() {
             thread.join();