Formatting

pull/320/head
Stjepan Glavina 5 years ago
parent 0adcb50f58
commit f9cfee9e2c

@ -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…
Cancel
Save