Skip to content

Commit

Permalink
rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfishcode committed Jul 27, 2020
1 parent a3a93e6 commit 97ef1db
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 10 deletions.
20 changes: 14 additions & 6 deletions benches/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ fn symlink_chasing_open(b: &mut test::Bencher) {

let name = "32";
b.iter(|| {
let _file = dir.open(name).unwrap();
let _file = dir.open(name).unwrap();
});
}

Expand All @@ -259,12 +259,16 @@ fn symlink_chasing_open_baseline(b: &mut test::Bencher) {

fs::File::create(dir.path().join("0")).unwrap();
for i in 0..32 {
symlink(dir.path().join(i.to_string()), dir.path().join((i + 1).to_string())).unwrap();
symlink(
dir.path().join(i.to_string()),
dir.path().join((i + 1).to_string()),
)
.unwrap();
}

let name = dir.path().join("32");
b.iter(|| {
let _file = fs::File::open(&name).unwrap();
let _file = fs::File::open(&name).unwrap();
});
}

Expand All @@ -280,7 +284,7 @@ fn symlink_chasing_metadata(b: &mut test::Bencher) {

let name = "32";
b.iter(|| {
let _metadata = dir.metadata(name).unwrap();
let _metadata = dir.metadata(name).unwrap();
});
}

Expand All @@ -293,12 +297,16 @@ fn symlink_chasing_metadata_baseline(b: &mut test::Bencher) {

fs::File::create(dir.path().join("0")).unwrap();
for i in 0..32 {
symlink(dir.path().join(i.to_string()), dir.path().join((i + 1).to_string())).unwrap();
symlink(
dir.path().join(i.to_string()),
dir.path().join((i + 1).to_string()),
)
.unwrap();
}

let name = dir.path().join("32");
b.iter(|| {
let _metadata = fs::metadata(&name).unwrap();
let _metadata = fs::metadata(&name).unwrap();
});
}

Expand Down
7 changes: 6 additions & 1 deletion cap-async-std/src/fs/dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,12 @@ impl Dir {
///
/// [`async_std::fs::copy`]: https://docs.rs/async-std/latest/async_std/fs/fn.copy.html
#[inline]
pub async fn copy<P: AsRef<Path>, Q: AsRef<Path>>(&self, from: P, to_dir: &Self, to: Q) -> io::Result<u64> {
pub async fn copy<P: AsRef<Path>, Q: AsRef<Path>>(
&self,
from: P,
to_dir: &Self,
to: Q,
) -> io::Result<u64> {
// Implementation derived from `copy` in Rust's
// src/libstd/sys_common/fs.rs at revision
// 7e11379f3b4c376fbb9a6c4d44f3286ccc28d149.
Expand Down
7 changes: 6 additions & 1 deletion cap-async-std/src/fs_utf8/dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,12 @@ impl Dir {
///
/// [`async_std::fs::copy`]: https://docs.rs/async-std/latest/async_std/fs/fn.copy.html
#[inline]
pub async fn copy<P: AsRef<str>, Q: AsRef<str>>(&self, from: P, to_dir: &Self, to: Q) -> io::Result<u64> {
pub async fn copy<P: AsRef<str>, Q: AsRef<str>>(
&self,
from: P,
to_dir: &Self,
to: Q,
) -> io::Result<u64> {
let from = from_utf8(from)?;
let to = from_utf8(to)?;
self.cap_std.copy(from, &to_dir.cap_std, to).await
Expand Down
7 changes: 6 additions & 1 deletion src/fs/dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,12 @@ impl Dir {
///
/// [`std::fs::copy`]: https://doc.rust-lang.org/std/fs/fn.copy.html
#[inline]
pub fn copy<P: AsRef<Path>, Q: AsRef<Path>>(&self, from: P, to_dir: &Self, to: Q) -> io::Result<u64> {
pub fn copy<P: AsRef<Path>, Q: AsRef<Path>>(
&self,
from: P,
to_dir: &Self,
to: Q,
) -> io::Result<u64> {
// Implementation derived from `copy` in Rust's
// src/libstd/sys_common/fs.rs at revision
// 7e11379f3b4c376fbb9a6c4d44f3286ccc28d149.
Expand Down
7 changes: 6 additions & 1 deletion src/fs_utf8/dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,12 @@ impl Dir {
///
/// [`std::fs::copy`]: https://doc.rust-lang.org/std/fs/fn.copy.html
#[inline]
pub fn copy<P: AsRef<str>, Q: AsRef<str>>(&self, from: P, to_dir: &Self, to: Q) -> io::Result<u64> {
pub fn copy<P: AsRef<str>, Q: AsRef<str>>(
&self,
from: P,
to_dir: &Self,
to: Q,
) -> io::Result<u64> {
let from = from_utf8(from)?;
let to = from_utf8(to)?;
self.cap_std.copy(from, &to_dir.cap_std, to)
Expand Down

0 comments on commit 97ef1db

Please sign in to comment.