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/fs.rs | |
| 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/fs.rs')
| -rw-r--r-- | src/libstd/sys/windows/ext/fs.rs | 65 |
1 files changed, 44 insertions, 21 deletions
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) } |
