about summary refs log tree commit diff
path: root/src/libstd/os/linux
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2019-11-27 10:28:21 -0800
committerDavid Tolnay <dtolnay@gmail.com>2019-11-29 18:32:46 -0800
commit60091ee826b071a122ad4ef4ae833591e1db553b (patch)
tree579a0152c996b81bb4d0a7e2e5494d0908fd9b8d /src/libstd/os/linux
parent9081929d45f12d3f56d43b1d6db7519981580fc9 (diff)
downloadrust-60091ee826b071a122ad4ef4ae833591e1db553b.tar.gz
rust-60091ee826b071a122ad4ef4ae833591e1db553b.zip
Format libstd/os with rustfmt
This commit applies rustfmt with rust-lang/rust's default settings to
files in src/libstd/os *that are not involved in any currently open PR*
to minimize merge conflicts. THe list of files involved in open PRs was
determined by querying GitHub's GraphQL API with this script:
https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8

With the list of files from the script in outstanding_files, the
relevant commands were:

    $ find src/libstd/os -name '*.rs' \
        | xargs rustfmt --edition=2018 --unstable-features --skip-children
    $ rg libstd/os outstanding_files | xargs git checkout --

Repeating this process several months apart should get us coverage of
most of the rest of the files.

To confirm no funny business:

    $ git checkout $THIS_COMMIT^
    $ git show --pretty= --name-only $THIS_COMMIT \
        | xargs rustfmt --edition=2018 --unstable-features --skip-children
    $ git diff $THIS_COMMIT  # there should be no difference
Diffstat (limited to 'src/libstd/os/linux')
-rw-r--r--src/libstd/os/linux/fs.rs10
-rw-r--r--src/libstd/os/linux/mod.rs2
-rw-r--r--src/libstd/os/linux/raw.rs147
3 files changed, 95 insertions, 64 deletions
diff --git a/src/libstd/os/linux/fs.rs b/src/libstd/os/linux/fs.rs
index 78321ac3185..dd71201b50b 100644
--- a/src/libstd/os/linux/fs.rs
+++ b/src/libstd/os/linux/fs.rs
@@ -34,10 +34,7 @@ pub trait MetadataExt {
     /// }
     /// ```
     #[stable(feature = "metadata_ext", since = "1.1.0")]
-    #[rustc_deprecated(
-        since = "1.8.0",
-        reason = "other methods of this trait are now prefered"
-    )]
+    #[rustc_deprecated(since = "1.8.0", reason = "other methods of this trait are now prefered")]
     #[allow(deprecated)]
     fn as_raw_stat(&self) -> &raw::stat;
 
@@ -328,10 +325,7 @@ pub trait MetadataExt {
 impl MetadataExt for Metadata {
     #[allow(deprecated)]
     fn as_raw_stat(&self) -> &raw::stat {
-        unsafe {
-            &*(self.as_inner().as_inner() as *const libc::stat64
-                                          as *const raw::stat)
-        }
+        unsafe { &*(self.as_inner().as_inner() as *const libc::stat64 as *const raw::stat) }
     }
     fn st_dev(&self) -> u64 {
         self.as_inner().as_inner().st_dev as u64
diff --git a/src/libstd/os/linux/mod.rs b/src/libstd/os/linux/mod.rs
index 3111325021a..d35307162cc 100644
--- a/src/libstd/os/linux/mod.rs
+++ b/src/libstd/os/linux/mod.rs
@@ -2,5 +2,5 @@
 
 #![stable(feature = "raw_ext", since = "1.1.0")]
 
-pub mod raw;
 pub mod fs;
+pub mod raw;
diff --git a/src/libstd/os/linux/raw.rs b/src/libstd/os/linux/raw.rs
index 21e1cf8a22b..d9b2236047b 100644
--- a/src/libstd/os/linux/raw.rs
+++ b/src/libstd/os/linux/raw.rs
@@ -1,41 +1,53 @@
 //! Linux-specific raw type definitions
 
 #![stable(feature = "raw_ext", since = "1.1.0")]
-#![rustc_deprecated(since = "1.8.0",
-                    reason = "these type aliases are no longer supported by \
-                              the standard library, the `libc` crate on \
-                              crates.io should be used instead for the correct \
-                              definitions")]
+#![rustc_deprecated(
+    since = "1.8.0",
+    reason = "these type aliases are no longer supported by \
+              the standard library, the `libc` crate on \
+              crates.io should be used instead for the correct \
+              definitions"
+)]
 #![allow(deprecated)]
 #![allow(missing_debug_implementations)]
 
 use crate::os::raw::c_ulong;
 
-#[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64;
-#[stable(feature = "raw_ext", since = "1.1.0")] pub type mode_t = u32;
+#[stable(feature = "raw_ext", since = "1.1.0")]
+pub type dev_t = u64;
+#[stable(feature = "raw_ext", since = "1.1.0")]
+pub type mode_t = u32;
 
 #[stable(feature = "pthread_t", since = "1.8.0")]
 pub type pthread_t = c_ulong;
 
 #[doc(inline)]
 #[stable(feature = "raw_ext", since = "1.1.0")]
-pub use self::arch::{off_t, ino_t, nlink_t, blksize_t, blkcnt_t, stat, time_t};
+pub use self::arch::{blkcnt_t, blksize_t, ino_t, nlink_t, off_t, stat, time_t};
 
-#[cfg(any(target_arch = "x86",
-          target_arch = "le32",
-          target_arch = "powerpc",
-          target_arch = "arm",
-          target_arch = "asmjs",
-          target_arch = "wasm32"))]
+#[cfg(any(
+    target_arch = "x86",
+    target_arch = "le32",
+    target_arch = "powerpc",
+    target_arch = "arm",
+    target_arch = "asmjs",
+    target_arch = "wasm32"
+))]
 mod arch {
     use crate::os::raw::{c_long, c_short, c_uint};
 
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64;
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64;
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = u64;
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = u64;
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = u64;
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type blkcnt_t = u64;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type blksize_t = u64;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type ino_t = u64;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type nlink_t = u64;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type off_t = u64;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type time_t = i64;
 
     #[repr(C)]
     #[derive(Clone)]
@@ -87,20 +99,29 @@ mod arch {
     use crate::os::raw::{c_long, c_ulong};
 
     #[cfg(target_env = "musl")]
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = i64;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type blkcnt_t = i64;
     #[cfg(not(target_env = "musl"))]
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64;
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type blkcnt_t = u64;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type blksize_t = u64;
     #[cfg(target_env = "musl")]
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = u64;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type ino_t = u64;
     #[cfg(not(target_env = "musl"))]
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = u64;
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = u64;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type ino_t = u64;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type nlink_t = u64;
     #[cfg(target_env = "musl")]
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = u64;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type off_t = u64;
     #[cfg(not(target_env = "musl"))]
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = u64;
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type off_t = u64;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type time_t = i64;
 
     #[repr(C)]
     #[derive(Clone)]
@@ -149,14 +170,20 @@ mod arch {
 
 #[cfg(target_arch = "hexagon")]
 mod arch {
-    use crate::os::raw::{c_long, c_int, c_longlong, culonglong};
+    use crate::os::raw::{c_int, c_long, c_longlong, culonglong};
 
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = c_longlong;
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = c_long;
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = c_ulonglong;
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = c_uint;
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = c_longlong;
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = c_long;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type blkcnt_t = c_longlong;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type blksize_t = c_long;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type ino_t = c_ulonglong;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type nlink_t = c_uint;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type off_t = c_longlong;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type time_t = c_long;
 
     #[repr(C)]
     #[derive(Clone)]
@@ -199,27 +226,31 @@ mod arch {
         #[stable(feature = "raw_ext", since = "1.1.0")]
         pub st_ctime_nsec: ::c_long,
         #[stable(feature = "raw_ext", since = "1.1.0")]
-        pub __pad3: [::c_int;2],
+        pub __pad3: [::c_int; 2],
     }
 }
 
-#[cfg(any(target_arch = "mips64",
-          target_arch = "s390x",
-          target_arch = "sparc64"))]
+#[cfg(any(target_arch = "mips64", target_arch = "s390x", target_arch = "sparc64"))]
 mod arch {
-    pub use libc::{off_t, ino_t, nlink_t, blksize_t, blkcnt_t, stat, time_t};
+    pub use libc::{blkcnt_t, blksize_t, ino_t, nlink_t, off_t, stat, time_t};
 }
 
 #[cfg(target_arch = "aarch64")]
 mod arch {
-    use crate::os::raw::{c_long, c_int};
+    use crate::os::raw::{c_int, c_long};
 
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64;
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64;
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = u64;
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = u64;
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = u64;
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type blkcnt_t = u64;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type blksize_t = u64;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type ino_t = u64;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type nlink_t = u64;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type off_t = u64;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type time_t = i64;
 
     #[repr(C)]
     #[derive(Clone)]
@@ -268,14 +299,20 @@ mod arch {
 
 #[cfg(any(target_arch = "x86_64", target_arch = "powerpc64"))]
 mod arch {
-    use crate::os::raw::{c_long, c_int};
+    use crate::os::raw::{c_int, c_long};
 
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64;
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64;
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = u64;
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = u64;
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = u64;
-    #[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type blkcnt_t = u64;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type blksize_t = u64;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type ino_t = u64;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type nlink_t = u64;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type off_t = u64;
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub type time_t = i64;
 
     #[repr(C)]
     #[derive(Clone)]