Skip to content

Commit 2bc703c

Browse files
committed
chore: fix imports
1 parent d646dd5 commit 2bc703c

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

src/fcntl.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use std::ffi::CStr;
1313
use std::ffi::OsString;
1414
#[cfg(not(any(target_os = "redox", target_os = "solaris")))]
1515
use std::ops::{Deref, DerefMut};
16-
use std::os::fd::BorrowedFd;
1716
#[cfg(not(target_os = "redox"))]
1817
use std::os::raw;
1918
use std::os::unix::ffi::OsStringExt;
@@ -30,9 +29,6 @@ use std::path::PathBuf;
3029
#[cfg(any(linux_android, target_os = "freebsd"))]
3130
use std::ptr;
3231

33-
#[cfg(feature = "fs")]
34-
use std::os::fd::FromRawFd;
35-
3632
#[cfg(feature = "fs")]
3733
use crate::{sys::stat::Mode, NixPath, Result};
3834

@@ -54,8 +50,8 @@ pub use self::posix_fadvise::{posix_fadvise, PosixFadviseAdvice};
5450
// 2. It is not a valid file descriptor, but OS will handle it for us when passed
5551
// to `xxat(2)` calls.
5652
#[cfg(not(target_os = "redox"))] // Redox does not have this
57-
pub const AT_FDCWD: BorrowedFd<'static> =
58-
unsafe { BorrowedFd::borrow_raw(libc::AT_FDCWD) };
53+
pub const AT_FDCWD: std::os::fd::BorrowedFd<'static> =
54+
unsafe { std::os::fd::BorrowedFd::borrow_raw(libc::AT_FDCWD) };
5955

6056
#[cfg(not(target_os = "redox"))]
6157
#[cfg(any(feature = "fs", feature = "process", feature = "user"))]
@@ -235,7 +231,9 @@ pub fn open<P: ?Sized + NixPath>(
235231
path: &P,
236232
oflag: OFlag,
237233
mode: Mode,
238-
) -> Result<OwnedFd> {
234+
) -> Result<std::os::fd::OwnedFd> {
235+
use std::os::fd::FromRawFd;
236+
239237
let fd = path.with_nix_path(|cstr| unsafe {
240238
libc::open(cstr.as_ptr(), oflag.bits(), mode.bits() as c_uint)
241239
})?;
@@ -244,7 +242,7 @@ pub fn open<P: ?Sized + NixPath>(
244242
// SAFETY:
245243
//
246244
// `open(2)` should return a valid owned fd on success
247-
Ok( unsafe { OwnedFd::from_raw_fd(fd) } )
245+
Ok( unsafe { std::os::fd::OwnedFd::from_raw_fd(fd) } )
248246
}
249247

250248
/// open or create a file for reading, writing or executing
@@ -265,6 +263,7 @@ pub fn openat<P: ?Sized + NixPath, Fd: std::os::fd::AsFd>(
265263
mode: Mode,
266264
) -> Result<OwnedFd> {
267265
use std::os::fd::AsRawFd;
266+
use std::os::fd::FromRawFd;
268267

269268
let fd = path.with_nix_path(|cstr| unsafe {
270269
libc::openat(dirfd.as_fd().as_raw_fd(), cstr.as_ptr(), oflag.bits(), mode.bits() as c_uint)
@@ -1350,7 +1349,7 @@ impl SpacectlRange {
13501349
/// f.write_all(INITIAL).unwrap();
13511350
/// let mut range = SpacectlRange(3, 6);
13521351
/// while (!range.is_empty()) {
1353-
/// range = fspacectl(f.as_raw_fd(), range).unwrap();
1352+
/// range = fspacectl(&f, range).unwrap();
13541353
/// }
13551354
/// let mut buf = vec![0; INITIAL.len()];
13561355
/// f.read_exact_at(&mut buf, 0).unwrap();
@@ -1402,7 +1401,7 @@ pub fn fspacectl<Fd: std::os::fd::AsFd>(fd: Fd, range: SpacectlRange) -> Result<
14021401
/// const INITIAL: &[u8] = b"0123456789abcdef";
14031402
/// let mut f = tempfile().unwrap();
14041403
/// f.write_all(INITIAL).unwrap();
1405-
/// fspacectl_all(f.as_raw_fd(), 3, 6).unwrap();
1404+
/// fspacectl_all(&f., 3, 6).unwrap();
14061405
/// let mut buf = vec![0; INITIAL.len()];
14071406
/// f.read_exact_at(&mut buf, 0).unwrap();
14081407
/// assert_eq!(buf, b"012\0\0\0\0\0\09abcdef");

test/test_pty.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ fn open_ptty_pair() -> (PtyMaster, File) {
103103
#[allow(clippy::comparison_chain)]
104104
{
105105
use libc::{ioctl, I_FIND, I_PUSH};
106-
use std::os::fd::AsRawFd;
107106

108107
// On illumos systems, as per pts(7D), one must push STREAMS modules
109108
// after opening a device path returned from ptsname().

0 commit comments

Comments
 (0)