From 0c786dfe62dc43b7a463d00fd9c37475ee5a1ce3 Mon Sep 17 00:00:00 2001 From: Jamie Hewland Date: Sun, 12 Nov 2017 12:10:41 +0200 Subject: [PATCH] unistd: Rework import of std::ptr --- src/unistd.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/unistd.rs b/src/unistd.rs index 2b2f3751b3..dc0d5d077c 100644 --- a/src/unistd.rs +++ b/src/unistd.rs @@ -6,7 +6,7 @@ use fcntl::{fcntl, OFlag, O_CLOEXEC, FD_CLOEXEC}; use fcntl::FcntlArg::F_SETFD; use libc::{self, c_char, c_void, c_int, c_long, c_uint, size_t, pid_t, off_t, uid_t, gid_t, mode_t}; -use std::{self, fmt, mem}; +use std::{fmt, mem, ptr}; use std::ffi::{CString, CStr, OsString, OsStr}; use std::os::unix::ffi::{OsStringExt, OsStrExt}; use std::os::unix::io::RawFd; @@ -553,9 +553,6 @@ pub fn chown(path: &P, owner: Option, group: Option Vec<*const c_char> { - use std::ptr; - use libc::c_char; - let mut args_p: Vec<*const c_char> = args.iter().map(|s| s.as_ptr()).collect(); args_p.push(ptr::null()); args_p @@ -1056,7 +1053,7 @@ pub fn setgid(gid: Gid) -> Result<()> { #[cfg(not(any(target_os = "ios", target_os = "macos")))] pub fn getgroups() -> Result> { // First get the number of groups so we can size our Vec - let ret = unsafe { libc::getgroups(0, std::ptr::null_mut()) }; + let ret = unsafe { libc::getgroups(0, ptr::null_mut()) }; // Now actually get the groups. We try multiple times in case the number of // groups has changed since the first call to getgroups() and the buffer is