Skip to content

Commit

Permalink
refactor: remove legacy #[doc(cfg(all()))] attributes (#2192)
Browse files Browse the repository at this point in the history
* refactor: remove legacy #[doc(cfg(all()))] attributes

* fix macOS

* revert unintended change
  • Loading branch information
SteveLauC committed Nov 14, 2023
1 parent 62bf9f1 commit 6bacfe0
Show file tree
Hide file tree
Showing 28 changed files with 0 additions and 622 deletions.
20 changes: 0 additions & 20 deletions src/fcntl.rs
Expand Up @@ -73,7 +73,6 @@ libc_bitflags!(
O_ACCMODE;
/// Use alternate I/O semantics.
#[cfg(target_os = "netbsd")]
#[cfg_attr(docsrs, doc(cfg(all())))]
O_ALT_IO;
/// Open the file in append-only mode.
O_APPEND;
Expand All @@ -82,7 +81,6 @@ libc_bitflags!(
target_os = "illumos",
target_os = "solaris",
target_os = "haiku")))]
#[cfg_attr(docsrs, doc(cfg(all())))]
O_ASYNC;
/// Closes the file descriptor once an `execve` call is made.
///
Expand All @@ -96,25 +94,21 @@ libc_bitflags!(
target_os = "freebsd",
target_os = "linux",
target_os = "netbsd"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
O_DIRECT;
/// If the specified path isn't a directory, fail.
#[cfg(not(any(target_os = "illumos", target_os = "solaris")))]
#[cfg_attr(docsrs, doc(cfg(all())))]
O_DIRECTORY;
/// Implicitly follow each `write()` with an `fdatasync()`.
#[cfg(any(target_os = "android",
apple_targets,
target_os = "linux",
target_os = "netbsd",
target_os = "openbsd"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
O_DSYNC;
/// Error out if a file was not created.
O_EXCL;
/// Open for execute only.
#[cfg(target_os = "freebsd")]
#[cfg_attr(docsrs, doc(cfg(all())))]
O_EXEC;
/// Open with an exclusive file lock.
#[cfg(any(target_os = "dragonfly",
Expand All @@ -123,7 +117,6 @@ libc_bitflags!(
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
O_EXLOCK;
/// Same as `O_SYNC`.
#[cfg(any(target_os = "dragonfly",
Expand All @@ -133,37 +126,30 @@ libc_bitflags!(
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
O_FSYNC;
/// Allow files whose sizes can't be represented in an `off_t` to be opened.
#[cfg(any(target_os = "android", target_os = "linux"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
O_LARGEFILE;
/// Do not update the file last access time during `read(2)`s.
#[cfg(any(target_os = "android", target_os = "linux"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
O_NOATIME;
/// Don't attach the device as the process' controlling terminal.
#[cfg(not(target_os = "redox"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
O_NOCTTY;
/// Same as `O_NONBLOCK`.
#[cfg(not(any(target_os = "redox", target_os = "haiku")))]
#[cfg_attr(docsrs, doc(cfg(all())))]
O_NDELAY;
/// `open()` will fail if the given path is a symbolic link.
O_NOFOLLOW;
/// When possible, open the file in nonblocking mode.
O_NONBLOCK;
/// Don't deliver `SIGPIPE`.
#[cfg(target_os = "netbsd")]
#[cfg_attr(docsrs, doc(cfg(all())))]
O_NOSIGPIPE;
/// Obtain a file descriptor for low-level access.
///
/// The file itself is not opened and other file operations will fail.
#[cfg(any(target_os = "android", target_os = "linux", target_os = "redox"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
O_PATH;
/// Only allow reading.
///
Expand All @@ -175,11 +161,9 @@ libc_bitflags!(
O_RDWR;
/// Similar to `O_DSYNC` but applies to `read`s instead.
#[cfg(any(target_os = "linux", target_os = "netbsd", target_os = "openbsd"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
O_RSYNC;
/// Skip search permission checks.
#[cfg(target_os = "netbsd")]
#[cfg_attr(docsrs, doc(cfg(all())))]
O_SEARCH;
/// Open with a shared file lock.
#[cfg(any(target_os = "dragonfly",
Expand All @@ -188,21 +172,17 @@ libc_bitflags!(
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
O_SHLOCK;
/// Implicitly follow each `write()` with an `fsync()`.
#[cfg(not(target_os = "redox"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
O_SYNC;
/// Create an unnamed temporary file.
#[cfg(any(target_os = "android", target_os = "linux"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
O_TMPFILE;
/// Truncate an existing regular file to 0 length if it allows writing.
O_TRUNC;
/// Restore default TTY attributes.
#[cfg(target_os = "freebsd")]
#[cfg_attr(docsrs, doc(cfg(all())))]
O_TTY_INIT;
/// Only allow writing.
///
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Expand Up @@ -41,7 +41,6 @@
//! * `zerocopy` - APIs like `sendfile` and `copy_file_range`
#![crate_name = "nix"]
#![cfg(unix)]
#![cfg_attr(docsrs, doc(cfg(all())))]
#![allow(non_camel_case_types)]
#![cfg_attr(test, deny(warnings))]
#![recursion_limit = "500"]
Expand Down
15 changes: 0 additions & 15 deletions src/mount/bsd.rs
Expand Up @@ -17,36 +17,29 @@ libc_bitflags!(
pub struct MntFlags: c_int {
/// ACL support enabled.
#[cfg(any(target_os = "netbsd", target_os = "freebsd"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
MNT_ACLS;
/// All I/O to the file system should be done asynchronously.
MNT_ASYNC;
/// dir should instead be a file system ID encoded as “FSID:val0:val1”.
#[cfg(target_os = "freebsd")]
#[cfg_attr(docsrs, doc(cfg(all())))]
MNT_BYFSID;
/// Force a read-write mount even if the file system appears to be
/// unclean.
MNT_FORCE;
/// GEOM journal support enabled.
#[cfg(target_os = "freebsd")]
#[cfg_attr(docsrs, doc(cfg(all())))]
MNT_GJOURNAL;
/// MAC support for objects.
#[cfg(any(target_os = "macos", target_os = "freebsd"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
MNT_MULTILABEL;
/// Disable read clustering.
#[cfg(any(target_os = "dragonfly", target_os = "freebsd"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
MNT_NOCLUSTERR;
/// Disable write clustering.
#[cfg(any(target_os = "dragonfly", target_os = "freebsd"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
MNT_NOCLUSTERW;
/// Enable NFS version 4 ACLs.
#[cfg(target_os = "freebsd")]
#[cfg_attr(docsrs, doc(cfg(all())))]
MNT_NFS4ACLS;
/// Do not update access times.
MNT_NOATIME;
Expand All @@ -56,7 +49,6 @@ libc_bitflags!(
MNT_NOSUID;
/// Do not follow symlinks.
#[cfg(any(target_os = "dragonfly", target_os = "freebsd"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
MNT_NOSYMFOLLOW;
/// Mount read-only.
MNT_RDONLY;
Expand All @@ -67,7 +59,6 @@ libc_bitflags!(
///
/// See [mksnap_ffs(8)](https://www.freebsd.org/cgi/man.cgi?query=mksnap_ffs)
#[cfg(any(target_os = "macos", target_os = "freebsd"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
MNT_SNAPSHOT;
/// Using soft updates.
#[cfg(any(
Expand All @@ -76,12 +67,10 @@ libc_bitflags!(
target_os = "netbsd",
target_os = "openbsd"
))]
#[cfg_attr(docsrs, doc(cfg(all())))]
MNT_SOFTDEP;
/// Directories with the SUID bit set chown new files to their own
/// owner.
#[cfg(any(target_os = "dragonfly", target_os = "freebsd"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
MNT_SUIDDIR;
/// All I/O to the file system should be done synchronously.
MNT_SYNCHRONOUS;
Expand All @@ -91,14 +80,12 @@ libc_bitflags!(
target_os = "freebsd",
target_os = "netbsd"
))]
#[cfg_attr(docsrs, doc(cfg(all())))]
MNT_UNION;
/// Indicates that the mount command is being applied to an already
/// mounted file system.
MNT_UPDATE;
/// Check vnode use counts.
#[cfg(target_os = "freebsd")]
#[cfg_attr(docsrs, doc(cfg(all())))]
MNT_NONBUSY;
}
);
Expand Down Expand Up @@ -198,7 +185,6 @@ pub type NmountResult = std::result::Result<(), NmountError>;
/// * [`nmount(2)`](https://www.freebsd.org/cgi/man.cgi?query=nmount)
/// * [`nullfs(5)`](https://www.freebsd.org/cgi/man.cgi?query=nullfs)
#[cfg(target_os = "freebsd")]
#[cfg_attr(docsrs, doc(cfg(all())))]
#[derive(Debug, Default)]
pub struct Nmount<'a> {
// n.b. notgull: In reality, this is a list that contains
Expand All @@ -210,7 +196,6 @@ pub struct Nmount<'a> {
}

#[cfg(target_os = "freebsd")]
#[cfg_attr(docsrs, doc(cfg(all())))]
impl<'a> Nmount<'a> {
/// Helper function to push a slice onto the `iov` array.
fn push_slice(&mut self, val: &'a [u8], is_owned: bool) {
Expand Down
2 changes: 0 additions & 2 deletions src/mount/mod.rs
@@ -1,6 +1,5 @@
//! Mount file systems
#[cfg(any(target_os = "android", target_os = "linux"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
mod linux;

#[cfg(any(target_os = "android", target_os = "linux"))]
Expand All @@ -13,7 +12,6 @@ pub use self::linux::*;
target_os = "netbsd",
target_os = "openbsd"
))]
#[cfg_attr(docsrs, doc(cfg(all())))]
mod bsd;

#[cfg(any(
Expand Down
2 changes: 0 additions & 2 deletions src/mqueue.rs
Expand Up @@ -88,11 +88,9 @@ pub struct MqdT(mqd_t);
// See https://sourceware.org/bugzilla/show_bug.cgi?id=21279
/// Size of a message queue attribute member
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub type mq_attr_member_t = i64;
/// Size of a message queue attribute member
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub type mq_attr_member_t = libc::c_long;

impl MqAttr {
Expand Down

0 comments on commit 6bacfe0

Please sign in to comment.