Skip to content

Commit

Permalink
Fix unused import warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfishcode committed Oct 24, 2023
1 parent 9aa9534 commit 2ddda31
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 53 deletions.
4 changes: 1 addition & 3 deletions src/fs/at.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::fs::AtFlags;
#[cfg(apple)]
use crate::fs::CloneFlags;
#[cfg(not(any(apple, target_os = "espidf", target_os = "vita", target_os = "wasi")))]
use crate::fs::FileType;
use crate::fs::{Dev, FileType};
#[cfg(linux_kernel)]
use crate::fs::RenameFlags;
#[cfg(not(any(target_os = "aix", target_os = "espidf")))]
Expand All @@ -33,8 +33,6 @@ use {
#[cfg(not(any(target_os = "espidf", target_os = "vita")))]
use {crate::fs::Timestamps, crate::timespec::Nsecs};

pub use backend::fs::types::{Dev, RawMode};

/// `UTIME_NOW` for use with [`utimensat`].
///
/// [`utimensat`]: crate::fs::utimensat
Expand Down
14 changes: 1 addition & 13 deletions src/fs/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,5 @@
use crate::backend;

pub use crate::io::FdFlags;
#[cfg(not(any(target_os = "espidf", target_os = "vita")))]
pub use backend::fs::types::Access;
pub use backend::fs::types::{Dev, Mode, OFlags};

#[cfg(not(any(target_os = "espidf", target_os = "redox")))]
pub use backend::fs::types::AtFlags;

#[cfg(apple)]
pub use backend::fs::types::{CloneFlags, CopyfileFlags};

#[cfg(linux_kernel)]
pub use backend::fs::types::*;

pub use crate::timespec::{Nsecs, Secs, Timespec};
pub use backend::fs::types::*;
3 changes: 1 addition & 2 deletions src/fs/fadvise.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::{backend, io};
use backend::fd::AsFd;

pub use backend::fs::types::Advice;
use backend::fs::types::Advice;

/// `posix_fadvise(fd, offset, len, advice)`—Declares an expected access
/// pattern for a file.
Expand Down
2 changes: 1 addition & 1 deletion src/fs/fcntl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub fn fcntl_get_seals<Fd: AsFd>(fd: Fd) -> io::Result<SealFlags> {
}

#[cfg(any(linux_kernel, target_os = "freebsd", target_os = "fuchsia"))]
pub use backend::fs::types::SealFlags;
use backend::fs::types::SealFlags;

/// `fcntl(fd, F_ADD_SEALS)`
///
Expand Down
4 changes: 1 addition & 3 deletions src/fs/fcopyfile.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use crate::fs::CopyfileFlags;
use crate::{backend, io};
use backend::fd::AsFd;

/// `copyfile_state_t`
pub use backend::fs::types::copyfile_state_t;
use backend::fs::types::copyfile_state_t;

/// `fcopyfile(from, to, state, flags)`
///
Expand Down
22 changes: 8 additions & 14 deletions src/fs/fd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ use crate::fs::{Gid, Uid};
use crate::fs::{OFlags, SeekFrom, Timespec};
use crate::{backend, io};
use backend::fd::{AsFd, BorrowedFd};

#[cfg(not(any(target_os = "espidf", target_os = "vita", target_os = "wasi")))]
pub use backend::fs::types::FlockOperation;

#[cfg(not(any(
netbsdlike,
solarish,
Expand All @@ -21,10 +17,12 @@ pub use backend::fs::types::FlockOperation;
target_os = "redox",
target_os = "vita",
)))]
pub use backend::fs::types::FallocateFlags;

pub use backend::fs::types::Stat;

use backend::fs::types::FallocateFlags;
#[cfg(not(any(target_os = "espidf", target_os = "vita", target_os = "wasi")))]
use backend::fs::types::FlockOperation;
#[cfg(linux_kernel)]
use backend::fs::types::FsWord;
use backend::fs::types::Stat;
#[cfg(not(any(
solarish,
target_os = "espidf",
Expand All @@ -35,13 +33,9 @@ pub use backend::fs::types::Stat;
target_os = "vita",
target_os = "wasi",
)))]
pub use backend::fs::types::StatFs;

use backend::fs::types::StatFs;
#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))]
pub use backend::fs::types::{StatVfs, StatVfsMountFlags};

#[cfg(linux_kernel)]
pub use backend::fs::types::FsWord;
use backend::fs::types::StatVfs;

/// Timestamps used by [`utimensat`] and [`futimens`].
///
Expand Down
4 changes: 0 additions & 4 deletions src/fs/file_type.rs

This file was deleted.

3 changes: 1 addition & 2 deletions src/fs/memfd_create.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::fd::OwnedFd;
use crate::{backend, io, path};

pub use backend::fs::types::MemfdFlags;
use backend::fs::types::MemfdFlags;

/// `memfd_create(path, flags)`
///
Expand Down
12 changes: 5 additions & 7 deletions src/fs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@ mod fcntl_apple;
#[cfg(apple)]
mod fcopyfile;
pub(crate) mod fd;
mod file_type;
#[cfg(apple)]
mod getpath;
#[cfg(not(target_os = "wasi"))] // WASI doesn't have get[gpu]id.
mod id;
#[cfg(not(target_os = "wasi"))]
#[cfg(linux_kernel)]
mod ioctl;
#[cfg(not(any(
target_os = "espidf",
Expand Down Expand Up @@ -90,19 +89,18 @@ pub use dir::{Dir, DirEntry};
target_os = "redox",
target_os = "vita",
)))]
pub use fadvise::{fadvise, Advice};
pub use fadvise::fadvise;
pub use fcntl::*;
#[cfg(apple)]
pub use fcntl_apple::*;
#[cfg(apple)]
pub use fcopyfile::*;
pub use fd::*;
pub use file_type::FileType;
#[cfg(apple)]
pub use getpath::getpath;
#[cfg(not(target_os = "wasi"))]
pub use id::*;
#[cfg(not(target_os = "wasi"))]
#[cfg(linux_kernel)]
pub use ioctl::*;
#[cfg(not(any(
target_os = "espidf",
Expand All @@ -113,7 +111,7 @@ pub use ioctl::*;
)))]
pub use makedev::*;
#[cfg(any(linux_kernel, target_os = "freebsd"))]
pub use memfd_create::{memfd_create, MemfdFlags};
pub use memfd_create::memfd_create;
#[cfg(linux_kernel)]
#[cfg(feature = "fs")]
pub use mount::*;
Expand All @@ -125,7 +123,7 @@ pub use seek_from::SeekFrom;
#[cfg(target_os = "linux")]
pub use sendfile::sendfile;
#[cfg(linux_kernel)]
pub use statx::{statx, Statx, StatxFlags, StatxTimestamp};
pub use statx::statx;
#[cfg(not(any(
target_os = "espidf",
target_os = "redox",
Expand Down
3 changes: 1 addition & 2 deletions src/fs/statx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
use crate::fd::AsFd;
use crate::fs::AtFlags;
use crate::{backend, io, path};

pub use backend::fs::types::{Statx, StatxFlags, StatxTimestamp};
use backend::fs::types::{Statx, StatxFlags};

#[cfg(feature = "linux_4_11")]
use backend::fs::syscalls::statx as _statx;
Expand Down
8 changes: 6 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,12 @@
// It is common in Linux and libc APIs for types to vary between platforms.
#![allow(clippy::useless_conversion)]
// Redox and WASI have enough differences that it isn't worth precisely
// conditionalizing all the `use`s for them.
#![cfg_attr(any(target_os = "redox", target_os = "wasi"), allow(unused_imports))]
// conditionalizing all the `use`s for them. Similar for if we don't have
// "all-apis".
#![cfg_attr(
any(target_os = "redox", target_os = "wasi", not(feature = "all-apis")),
allow(unused_imports)
)]

#[cfg(all(feature = "alloc", not(feature = "rustc-dep-of-std")))]
extern crate alloc;
Expand Down
1 change: 1 addition & 0 deletions src/maybe_polyfill/no_std/net/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
mod ip_addr;
mod socket_addr;

#[allow(unused_imports)]
pub use self::ip_addr::{IpAddr, Ipv4Addr, Ipv6Addr, Ipv6MulticastScope};
pub use self::socket_addr::{SocketAddr, SocketAddrV4, SocketAddrV6};

0 comments on commit 2ddda31

Please sign in to comment.