Skip to content

Commit 8dc2afc

Browse files
committed
pollfd.len() is always 1, so the compiler should be able to eliminate this unwrap
1 parent 8d4a1a6 commit 8dc2afc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/pam/rpassword.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,13 @@ impl io::Read for TimeoutRead<'_> {
219219
};
220220

221221
// SAFETY: pollfd is initialized and its length matches
222-
cerr(unsafe { libc::poll(pollfd.as_mut_ptr(), pollfd.len() as u64, timeout) })?;
222+
cerr(unsafe {
223+
libc::poll(
224+
pollfd.as_mut_ptr(),
225+
pollfd.len().try_into().unwrap(),
226+
timeout,
227+
)
228+
})?;
223229

224230
// There may yet be data waiting to be read even if POLLHUP is set.
225231
if pollfd[0].revents & (pollmask | libc::POLLHUP) > 0 {

0 commit comments

Comments
 (0)