diff options
| author | David Tolnay <dtolnay@gmail.com> | 2019-11-27 10:28:39 -0800 |
|---|---|---|
| committer | David Tolnay <dtolnay@gmail.com> | 2019-11-29 18:37:58 -0800 |
| commit | c34fbfaad38cf5829ef5cfe780dc9d58480adeaa (patch) | |
| tree | e57b66ed06aec18dc13ff7f14a243ca3dc3c27d1 /src/libstd/sys/windows/ext | |
| parent | 9081929d45f12d3f56d43b1d6db7519981580fc9 (diff) | |
| download | rust-c34fbfaad38cf5829ef5cfe780dc9d58480adeaa.tar.gz rust-c34fbfaad38cf5829ef5cfe780dc9d58480adeaa.zip | |
Format libstd/sys with rustfmt
This commit applies rustfmt with rust-lang/rust's default settings to
files in src/libstd/sys *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/sys -name '*.rs' \
| xargs rustfmt --edition=2018 --unstable-features --skip-children
$ rg libstd/sys 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/sys/windows/ext')
| -rw-r--r-- | src/libstd/sys/windows/ext/ffi.rs | 4 | ||||
| -rw-r--r-- | src/libstd/sys/windows/ext/fs.rs | 65 | ||||
| -rw-r--r-- | src/libstd/sys/windows/ext/io.rs | 6 | ||||
| -rw-r--r-- | src/libstd/sys/windows/ext/mod.rs | 23 | ||||
| -rw-r--r-- | src/libstd/sys/windows/ext/process.rs | 4 | ||||
| -rw-r--r-- | src/libstd/sys/windows/ext/raw.rs | 9 | ||||
| -rw-r--r-- | src/libstd/sys/windows/ext/thread.rs | 6 |
7 files changed, 74 insertions, 43 deletions
diff --git a/src/libstd/sys/windows/ext/ffi.rs b/src/libstd/sys/windows/ext/ffi.rs index 1381825806f..6e78119383f 100644 --- a/src/libstd/sys/windows/ext/ffi.rs +++ b/src/libstd/sys/windows/ext/ffi.rs @@ -59,10 +59,10 @@ #![stable(feature = "rust1", since = "1.0.0")] -use crate::ffi::{OsString, OsStr}; +use crate::ffi::{OsStr, OsString}; use crate::sys::os_str::Buf; use crate::sys_common::wtf8::Wtf8Buf; -use crate::sys_common::{FromInner, AsInner}; +use crate::sys_common::{AsInner, FromInner}; #[stable(feature = "rust1", since = "1.0.0")] pub use crate::sys_common::wtf8::EncodeWide; diff --git a/src/libstd/sys/windows/ext/fs.rs b/src/libstd/sys/windows/ext/fs.rs index 23964dc5bd5..7eaff226a76 100644 --- a/src/libstd/sys/windows/ext/fs.rs +++ b/src/libstd/sys/windows/ext/fs.rs @@ -2,11 +2,11 @@ #![stable(feature = "rust1", since = "1.0.0")] -use crate::fs::{self, OpenOptions, Metadata}; +use crate::fs::{self, Metadata, OpenOptions}; use crate::io; use crate::path::Path; use crate::sys; -use crate::sys_common::{AsInnerMut, AsInner}; +use crate::sys_common::{AsInner, AsInnerMut}; /// Windows-specific extensions to [`File`]. /// @@ -265,23 +265,28 @@ pub trait OpenOptionsExt { #[stable(feature = "open_options_ext", since = "1.10.0")] impl OpenOptionsExt for OpenOptions { fn access_mode(&mut self, access: u32) -> &mut OpenOptions { - self.as_inner_mut().access_mode(access); self + self.as_inner_mut().access_mode(access); + self } fn share_mode(&mut self, share: u32) -> &mut OpenOptions { - self.as_inner_mut().share_mode(share); self + self.as_inner_mut().share_mode(share); + self } fn custom_flags(&mut self, flags: u32) -> &mut OpenOptions { - self.as_inner_mut().custom_flags(flags); self + self.as_inner_mut().custom_flags(flags); + self } fn attributes(&mut self, attributes: u32) -> &mut OpenOptions { - self.as_inner_mut().attributes(attributes); self + self.as_inner_mut().attributes(attributes); + self } fn security_qos_flags(&mut self, flags: u32) -> &mut OpenOptions { - self.as_inner_mut().security_qos_flags(flags); self + self.as_inner_mut().security_qos_flags(flags); + self } } @@ -468,14 +473,30 @@ pub trait MetadataExt { #[stable(feature = "metadata_ext", since = "1.1.0")] impl MetadataExt for Metadata { - fn file_attributes(&self) -> u32 { self.as_inner().attrs() } - fn creation_time(&self) -> u64 { self.as_inner().created_u64() } - fn last_access_time(&self) -> u64 { self.as_inner().accessed_u64() } - fn last_write_time(&self) -> u64 { self.as_inner().modified_u64() } - fn file_size(&self) -> u64 { self.as_inner().size() } - fn volume_serial_number(&self) -> Option<u32> { self.as_inner().volume_serial_number() } - fn number_of_links(&self) -> Option<u32> { self.as_inner().number_of_links() } - fn file_index(&self) -> Option<u64> { self.as_inner().file_index() } + fn file_attributes(&self) -> u32 { + self.as_inner().attrs() + } + fn creation_time(&self) -> u64 { + self.as_inner().created_u64() + } + fn last_access_time(&self) -> u64 { + self.as_inner().accessed_u64() + } + fn last_write_time(&self) -> u64 { + self.as_inner().modified_u64() + } + fn file_size(&self) -> u64 { + self.as_inner().size() + } + fn volume_serial_number(&self) -> Option<u32> { + self.as_inner().volume_serial_number() + } + fn number_of_links(&self) -> Option<u32> { + self.as_inner().number_of_links() + } + fn file_index(&self) -> Option<u64> { + self.as_inner().file_index() + } } /// Windows-specific extensions to [`FileType`]. @@ -495,8 +516,12 @@ pub trait FileTypeExt { #[unstable(feature = "windows_file_type_ext", issue = "0")] impl FileTypeExt for fs::FileType { - fn is_symlink_dir(&self) -> bool { self.as_inner().is_symlink_dir() } - fn is_symlink_file(&self) -> bool { self.as_inner().is_symlink_file() } + fn is_symlink_dir(&self) -> bool { + self.as_inner().is_symlink_dir() + } + fn is_symlink_file(&self) -> bool { + self.as_inner().is_symlink_file() + } } /// Creates a new file symbolic link on the filesystem. @@ -515,8 +540,7 @@ impl FileTypeExt for fs::FileType { /// } /// ``` #[stable(feature = "symlink", since = "1.1.0")] -pub fn symlink_file<P: AsRef<Path>, Q: AsRef<Path>>(src: P, dst: Q) - -> io::Result<()> { +pub fn symlink_file<P: AsRef<Path>, Q: AsRef<Path>>(src: P, dst: Q) -> io::Result<()> { sys::fs::symlink_inner(src.as_ref(), dst.as_ref(), false) } @@ -536,7 +560,6 @@ pub fn symlink_file<P: AsRef<Path>, Q: AsRef<Path>>(src: P, dst: Q) /// } /// ``` #[stable(feature = "symlink", since = "1.1.0")] -pub fn symlink_dir<P: AsRef<Path>, Q: AsRef<Path>>(src: P, dst: Q) - -> io::Result<()> { +pub fn symlink_dir<P: AsRef<Path>, Q: AsRef<Path>>(src: P, dst: Q) -> io::Result<()> { sys::fs::symlink_inner(src.as_ref(), dst.as_ref(), true) } diff --git a/src/libstd/sys/windows/ext/io.rs b/src/libstd/sys/windows/ext/io.rs index ec47c2e9d5a..4573ee58932 100644 --- a/src/libstd/sys/windows/ext/io.rs +++ b/src/libstd/sys/windows/ext/io.rs @@ -1,12 +1,12 @@ #![stable(feature = "rust1", since = "1.0.0")] use crate::fs; -use crate::os::windows::raw; +use crate::io; use crate::net; -use crate::sys_common::{self, AsInner, FromInner, IntoInner}; +use crate::os::windows::raw; use crate::sys; use crate::sys::c; -use crate::io; +use crate::sys_common::{self, AsInner, FromInner, IntoInner}; /// Raw HANDLEs. #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libstd/sys/windows/ext/mod.rs b/src/libstd/sys/windows/ext/mod.rs index 0a6d435d329..613d3dc189a 100644 --- a/src/libstd/sys/windows/ext/mod.rs +++ b/src/libstd/sys/windows/ext/mod.rs @@ -13,8 +13,8 @@ pub mod ffi; pub mod fs; pub mod io; -pub mod raw; pub mod process; +pub mod raw; pub mod thread; /// A prelude for conveniently writing platform-specific code. @@ -22,14 +22,19 @@ pub mod thread; /// Includes all extension traits, and some important type definitions. #[stable(feature = "rust1", since = "1.0.0")] pub mod prelude { - #[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")] - pub use super::io::{RawSocket, RawHandle, AsRawSocket, AsRawHandle}; - #[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")] - pub use super::io::{FromRawSocket, FromRawHandle, IntoRawSocket, IntoRawHandle}; - #[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")] + #[doc(no_inline)] + #[stable(feature = "rust1", since = "1.0.0")] pub use super::ffi::{OsStrExt, OsStringExt}; - #[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")] - pub use super::fs::{OpenOptionsExt, MetadataExt}; - #[doc(no_inline)] #[stable(feature = "file_offset", since = "1.15.0")] + #[doc(no_inline)] + #[stable(feature = "file_offset", since = "1.15.0")] pub use super::fs::FileExt; + #[doc(no_inline)] + #[stable(feature = "rust1", since = "1.0.0")] + pub use super::fs::{MetadataExt, OpenOptionsExt}; + #[doc(no_inline)] + #[stable(feature = "rust1", since = "1.0.0")] + pub use super::io::{AsRawHandle, AsRawSocket, RawHandle, RawSocket}; + #[doc(no_inline)] + #[stable(feature = "rust1", since = "1.0.0")] + pub use super::io::{FromRawHandle, FromRawSocket, IntoRawHandle, IntoRawSocket}; } diff --git a/src/libstd/sys/windows/ext/process.rs b/src/libstd/sys/windows/ext/process.rs index b2e6cdead4f..ed35c5ff194 100644 --- a/src/libstd/sys/windows/ext/process.rs +++ b/src/libstd/sys/windows/ext/process.rs @@ -2,10 +2,10 @@ #![stable(feature = "process_extensions", since = "1.2.0")] -use crate::os::windows::io::{FromRawHandle, RawHandle, AsRawHandle, IntoRawHandle}; +use crate::os::windows::io::{AsRawHandle, FromRawHandle, IntoRawHandle, RawHandle}; use crate::process; use crate::sys; -use crate::sys_common::{AsInnerMut, AsInner, FromInner, IntoInner}; +use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner}; #[stable(feature = "process_extensions", since = "1.2.0")] impl FromRawHandle for process::Stdio { diff --git a/src/libstd/sys/windows/ext/raw.rs b/src/libstd/sys/windows/ext/raw.rs index d2bab272036..7f2a2877828 100644 --- a/src/libstd/sys/windows/ext/raw.rs +++ b/src/libstd/sys/windows/ext/raw.rs @@ -4,8 +4,11 @@ use crate::os::raw::c_void; -#[stable(feature = "raw_ext", since = "1.1.0")] pub type HANDLE = *mut c_void; +#[stable(feature = "raw_ext", since = "1.1.0")] +pub type HANDLE = *mut c_void; #[cfg(target_pointer_width = "32")] -#[stable(feature = "raw_ext", since = "1.1.0")] pub type SOCKET = u32; +#[stable(feature = "raw_ext", since = "1.1.0")] +pub type SOCKET = u32; #[cfg(target_pointer_width = "64")] -#[stable(feature = "raw_ext", since = "1.1.0")] pub type SOCKET = u64; +#[stable(feature = "raw_ext", since = "1.1.0")] +pub type SOCKET = u64; diff --git a/src/libstd/sys/windows/ext/thread.rs b/src/libstd/sys/windows/ext/thread.rs index fdc7e7fa32f..41c29f5b950 100644 --- a/src/libstd/sys/windows/ext/thread.rs +++ b/src/libstd/sys/windows/ext/thread.rs @@ -2,9 +2,9 @@ #![stable(feature = "thread_extensions", since = "1.9.0")] -use crate::os::windows::io::{RawHandle, AsRawHandle, IntoRawHandle}; -use crate::thread; +use crate::os::windows::io::{AsRawHandle, IntoRawHandle, RawHandle}; use crate::sys_common::{AsInner, IntoInner}; +use crate::thread; #[stable(feature = "thread_extensions", since = "1.9.0")] impl<T> AsRawHandle for thread::JoinHandle<T> { @@ -14,7 +14,7 @@ impl<T> AsRawHandle for thread::JoinHandle<T> { } #[stable(feature = "thread_extensions", since = "1.9.0")] -impl<T> IntoRawHandle for thread::JoinHandle<T> { +impl<T> IntoRawHandle for thread::JoinHandle<T> { fn into_raw_handle(self) -> RawHandle { self.into_inner().into_handle().into_raw() as *mut _ } |
