mirror of
https://github.com/async-rs/async-std.git
synced 2025-03-29 04:26:41 +00:00
Formatting
This commit is contained in:
parent
0adcb50f58
commit
f9cfee9e2c
2 changed files with 4 additions and 9 deletions
|
@ -1,6 +1,5 @@
|
||||||
use crate::path::{Path, PathBuf};
|
|
||||||
|
|
||||||
use crate::io;
|
use crate::io;
|
||||||
|
use crate::path::{Path, PathBuf};
|
||||||
use crate::task::blocking;
|
use crate::task::blocking;
|
||||||
|
|
||||||
/// Returns the canonical form of a path.
|
/// Returns the canonical form of a path.
|
||||||
|
@ -32,8 +31,6 @@ use crate::task::blocking;
|
||||||
/// # Ok(()) }) }
|
/// # Ok(()) }) }
|
||||||
/// ```
|
/// ```
|
||||||
pub async fn canonicalize<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
|
pub async fn canonicalize<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
|
||||||
let path: PathBuf = path.as_ref().to_owned();
|
let path = path.as_ref().to_owned();
|
||||||
Ok(blocking::spawn(async move { std::fs::canonicalize(&path) })
|
blocking::spawn(async move { std::fs::canonicalize(&path).map(Into::into) }).await
|
||||||
.await?
|
|
||||||
.into())
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,5 @@ use crate::task::blocking;
|
||||||
/// ```
|
/// ```
|
||||||
pub async fn read_link<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
|
pub async fn read_link<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
|
||||||
let path = path.as_ref().to_owned();
|
let path = path.as_ref().to_owned();
|
||||||
Ok(blocking::spawn(async move { std::fs::read_link(path) })
|
blocking::spawn(async move { std::fs::read_link(path).map(Into::into) }).await
|
||||||
.await?
|
|
||||||
.into())
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue