Skip to content

Commit fab0707

Browse files
committed
Respond to sussurrus's comments
1 parent 0847bbf commit fab0707

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

test/sys/test_aio.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ extern fn sigfunc(_: c_int) {
243243
#[test]
244244
#[cfg_attr(any(all(target_env = "musl", target_arch = "x86_64"), target_arch = "mips"), ignore)]
245245
fn test_write_sigev_signal() {
246+
#[allow(unused_variables)]
246247
let m = ::SIGUSR2_MTX.lock().expect("Mutex got poisoned by another test");
247248
let sa = SigAction::new(SigHandler::Handler(sigfunc),
248249
SA_RESETHAND,
@@ -276,7 +277,6 @@ fn test_write_sigev_signal() {
276277
let len = f.read_to_end(&mut rbuf).unwrap();
277278
assert!(len == EXPECT.len());
278279
assert!(rbuf == EXPECT);
279-
drop(m); // appease the unused_variable checker
280280
}
281281

282282
// Test lio_listio with LIO_WAIT, so all AIO ops should be complete by the time
@@ -374,6 +374,7 @@ fn test_lio_listio_nowait() {
374374
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
375375
#[cfg_attr(any(target_arch = "mips", target_env = "musl"), ignore)]
376376
fn test_lio_listio_signal() {
377+
#[allow(unused_variables)]
377378
let m = ::SIGUSR2_MTX.lock().expect("Mutex got poisoned by another test");
378379
const INITIAL: &'static [u8] = b"abcdef123456";
379380
const WBUF: &'static [u8] = b"CDEF";
@@ -420,7 +421,6 @@ fn test_lio_listio_signal() {
420421
let len = f.read_to_end(&mut rbuf2).unwrap();
421422
assert!(len == EXPECT.len());
422423
assert!(rbuf2 == EXPECT);
423-
drop(m); // appease the unused_variable checker
424424
}
425425

426426
// Try to use lio_listio to read into an immutable buffer. It should fail

test/sys/test_wait.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fn test_wait_signal() {
1717
// panic, fork should never fail unless there is a serious problem with the OS
1818
Err(_) => panic!("Error: Fork Failed")
1919
}
20-
drop(m); // appease the unused_variable checker
20+
drop(m); // Appease the unused_variable checker
2121
}
2222

2323
#[test]
@@ -32,5 +32,5 @@ fn test_wait_exit() {
3232
// panic, fork should never fail unless there is a serious problem with the OS
3333
Err(_) => panic!("Error: Fork Failed")
3434
}
35-
drop(m); // appease the unused_variable checker
35+
drop(m); // Appease the unused_variable checker
3636
}

test/test_mq.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use nix::Error::Sys;
1616

1717
#[test]
1818
fn test_mq_send_and_receive() {
19+
#[allow(unused_variables)]
1920
let m = ::FORK_MTX.lock().expect("Mutex got poisoned by another test");
2021

2122
const MSG_SIZE: c_long = 32;
@@ -54,7 +55,6 @@ fn test_mq_send_and_receive() {
5455
// panic, fork should never fail unless there is a serious problem with the OS
5556
Err(_) => panic!("Error: Fork Failed")
5657
}
57-
drop(m); //appease the unused_variable checker
5858
}
5959

6060

test/test_unistd.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@ use std::io::Write;
1111
use std::os::unix::prelude::*;
1212
use tempfile::tempfile;
1313
use tempdir::TempDir;
14-
use libc::{_exit, off_t};
14+
use libc::off_t;
15+
use std::process::exit;
1516

1617
#[test]
1718
fn test_fork_and_waitpid() {
19+
#[allow(unused_variables)]
1820
let m = ::FORK_MTX.lock().expect("Mutex got poisoned by another test");
1921
let pid = fork();
2022
match pid {
21-
Ok(Child) => { unsafe { _exit(0) }; }
23+
Ok(Child) => { exit(0); }
2224
Ok(Parent { child }) => {
2325
// assert that child was created and pid > 0
2426
let child_raw: ::libc::pid_t = child.into();
@@ -39,16 +41,16 @@ fn test_fork_and_waitpid() {
3941
// panic, fork should never fail unless there is a serious problem with the OS
4042
Err(_) => panic!("Error: Fork Failed")
4143
}
42-
drop(m); // appease the unused_variable checker
4344
}
4445

4546
#[test]
4647
fn test_wait() {
47-
// grab FORK_MTX so wait doesn't reap a different test's child process
48+
// Grab FORK_MTX so wait doesn't reap a different test's child process
49+
#[allow(unused_variables)]
4850
let m = ::FORK_MTX.lock().expect("Mutex got poisoned by another test");
4951
let pid = fork();
5052
match pid {
51-
Ok(Child) => { unsafe { _exit(0) }; }
53+
Ok(Child) => { exit(0); }
5254
Ok(Parent { child }) => {
5355
let wait_status = wait();
5456

@@ -58,7 +60,6 @@ fn test_wait() {
5860
// panic, fork should never fail unless there is a serious problem with the OS
5961
Err(_) => panic!("Error: Fork Failed")
6062
}
61-
drop(m); // appease the unused_variable checker
6263
}
6364

6465
#[test]
@@ -104,6 +105,7 @@ macro_rules! execve_test_factory(
104105
($test_name:ident, $syscall:ident, $unix_sh:expr, $android_sh:expr) => (
105106
#[test]
106107
fn $test_name() {
108+
#[allow(unused_variables)]
107109
let m = ::FORK_MTX.lock().expect("Mutex got poisoned by another test");
108110
// The `exec`d process will write to `writer`, and we'll read that
109111
// data from `reader`.
@@ -144,14 +146,14 @@ macro_rules! execve_test_factory(
144146
assert!(string.contains("baz=quux"));
145147
}
146148
}
147-
drop(m); // appease the unused_variable checker
148149
}
149150
)
150151
);
151152

152153
#[test]
153154
fn test_fchdir() {
154155
// fchdir changes the process's cwd
156+
#[allow(unused_variables)]
155157
let m = ::CWD_MTX.lock().expect("Mutex got poisoned by another test");
156158
let tmpdir = TempDir::new("test_fchdir").unwrap();
157159
let tmpdir_path = tmpdir.path().canonicalize().unwrap();
@@ -161,12 +163,12 @@ fn test_fchdir() {
161163
assert_eq!(getcwd().unwrap(), tmpdir_path);
162164

163165
assert!(close(tmpdir_fd).is_ok());
164-
drop(m); // appease the unused_variable checker
165166
}
166167

167168
#[test]
168169
fn test_getcwd() {
169170
// chdir changes the process's cwd
171+
#[allow(unused_variables)]
170172
let m = ::CWD_MTX.lock().expect("Mutex got poisoned by another test");
171173
let tmp_dir = TempDir::new("test_getcwd").unwrap();
172174
assert!(chdir(tmp_dir.path()).is_ok());
@@ -184,7 +186,6 @@ fn test_getcwd() {
184186
}
185187
assert!(chdir(inner_tmp_dir.as_path()).is_ok());
186188
assert_eq!(getcwd().unwrap(), inner_tmp_dir.as_path());
187-
drop(m); // appease the unused_variable checker
188189
}
189190

190191
#[test]

0 commit comments

Comments
 (0)