Skip to content

Commit 234b862

Browse files
committed
Allow unused_unsafe warning
Use #[allow(unused_unsafe)] to work around inconsitency with fn unsafe in libc after [#1870](rust-lang/libc#1870) change.
1 parent c4e5f0b commit 234b862

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

src/sys/quota.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ struct QuotaCmd(QuotaSubCmd, QuotaType);
2222

2323
impl QuotaCmd {
2424
fn as_int(&self) -> c_int {
25-
libc::QCMD(self.0 as i32, self.1 as i32)
25+
#[allow(unused_unsafe)]
26+
unsafe { libc::QCMD(self.0 as i32, self.1 as i32) }
2627
}
2728
}
2829

src/sys/wait.rs

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,31 +118,38 @@ impl WaitStatus {
118118
}
119119

120120
fn exited(status: i32) -> bool {
121-
libc::WIFEXITED(status)
121+
#[allow(unused_unsafe)]
122+
unsafe { libc::WIFEXITED(status) }
122123
}
123124

124125
fn exit_status(status: i32) -> i32 {
125-
libc::WEXITSTATUS(status)
126+
#[allow(unused_unsafe)]
127+
unsafe { libc::WEXITSTATUS(status) }
126128
}
127129

128130
fn signaled(status: i32) -> bool {
129-
libc::WIFSIGNALED(status)
131+
#[allow(unused_unsafe)]
132+
unsafe { libc::WIFSIGNALED(status) }
130133
}
131134

132135
fn term_signal(status: i32) -> Result<Signal> {
133-
Signal::try_from(libc::WTERMSIG(status))
136+
#[allow(unused_unsafe)]
137+
Signal::try_from(unsafe { libc::WTERMSIG(status) })
134138
}
135139

136140
fn dumped_core(status: i32) -> bool {
137-
libc::WCOREDUMP(status)
141+
#[allow(unused_unsafe)]
142+
unsafe { libc::WCOREDUMP(status) }
138143
}
139144

140145
fn stopped(status: i32) -> bool {
141-
libc::WIFSTOPPED(status)
146+
#[allow(unused_unsafe)]
147+
unsafe { libc::WIFSTOPPED(status) }
142148
}
143149

144150
fn stop_signal(status: i32) -> Result<Signal> {
145-
Signal::try_from(libc::WSTOPSIG(status))
151+
#[allow(unused_unsafe)]
152+
Signal::try_from(unsafe { libc::WSTOPSIG(status) })
146153
}
147154

148155
#[cfg(any(target_os = "android", target_os = "linux"))]
@@ -151,7 +158,8 @@ fn syscall_stop(status: i32) -> bool {
151158
// of delivering SIGTRAP | 0x80 as the signal number for syscall
152159
// stops. This allows easily distinguishing syscall stops from
153160
// genuine SIGTRAP signals.
154-
libc::WSTOPSIG(status) == libc::SIGTRAP | 0x80
161+
#[allow(unused_unsafe)]
162+
unsafe { libc::WSTOPSIG(status) == libc::SIGTRAP | 0x80 }
155163
}
156164

157165
#[cfg(any(target_os = "android", target_os = "linux"))]
@@ -160,7 +168,8 @@ fn stop_additional(status: i32) -> c_int {
160168
}
161169

162170
fn continued(status: i32) -> bool {
163-
libc::WIFCONTINUED(status)
171+
#[allow(unused_unsafe)]
172+
unsafe { libc::WIFCONTINUED(status) }
164173
}
165174

166175
impl WaitStatus {

0 commit comments

Comments
 (0)