std::rt: deny(unused_unsafe)

This commit is contained in:
Brian Anderson 2013-06-23 14:15:39 -07:00
parent b530ca1033
commit d071f51cdc
3 changed files with 5 additions and 4 deletions

View File

@ -58,6 +58,7 @@ Several modules in `core` are clients of `rt`:
#[deny(unused_imports)];
#[deny(unused_mut)];
#[deny(unused_variable)];
#[deny(unused_unsafe)];
use cell::Cell;
use clone::Clone;
@ -224,7 +225,7 @@ pub fn run(main: ~fn()) -> int {
let nthreads = match os::getenv("RUST_THREADS") {
Some(nstr) => FromStr::from_str(nstr).get(),
None => unsafe { util::num_cpus() }
None => util::num_cpus()
};
// The shared list of sleeping schedulers. Schedulers wake each other

View File

@ -74,7 +74,7 @@ pub fn run_in_mt_newsched_task(f: ~fn()) {
do run_in_bare_thread {
let nthreads = match os::getenv("RUST_TEST_THREADS") {
Some(nstr) => FromStr::from_str(nstr).get(),
None => unsafe {
None => {
// Using more threads than cores in test code
// to force the OS to preempt them frequently.
// Assuming that this help stress test concurrent types.

View File

@ -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(||());
}
}