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::path::{Path, PathBuf};
use crate::task::blocking;
/// Returns the canonical form of a path.
@ -32,8 +31,6 @@ use crate::task::blocking;
/// # Ok(()) }) }
/// ```
pub async fn canonicalize<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
let path: PathBuf = path.as_ref().to_owned();
Ok(blocking::spawn(async move { std::fs::canonicalize(&path) })
.await?
.into())
let path = path.as_ref().to_owned();
blocking::spawn(async move { std::fs::canonicalize(&path).map(Into::into) }).await
}

@ -28,7 +28,5 @@ use crate::task::blocking;
/// ```
pub async fn read_link<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
let path = path.as_ref().to_owned();
Ok(blocking::spawn(async move { std::fs::read_link(path) })
.await?
.into())
blocking::spawn(async move { std::fs::read_link(path).map(Into::into) }).await
}

Loading…
Cancel
Save