mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-02 18:20:03 +00:00
Rm unnecessary to_owned
call in extract_*
It was called before because `spawn_blocking` requires that, but we now switches to `block_in_place` which no longer needs this. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
9de8a4841f
commit
a5879e3d65
1 changed files with 4 additions and 10 deletions
|
@ -40,13 +40,11 @@ where
|
||||||
|
|
||||||
pub async fn extract_bin<E>(
|
pub async fn extract_bin<E>(
|
||||||
stream: impl Stream<Item = Result<Bytes, E>> + Unpin,
|
stream: impl Stream<Item = Result<Bytes, E>> + Unpin,
|
||||||
output: &Path,
|
path: &Path,
|
||||||
) -> Result<(), BinstallError>
|
) -> Result<(), BinstallError>
|
||||||
where
|
where
|
||||||
BinstallError: From<E>,
|
BinstallError: From<E>,
|
||||||
{
|
{
|
||||||
let path = output.to_owned();
|
|
||||||
|
|
||||||
extract_impl(stream, move |mut reader| {
|
extract_impl(stream, move |mut reader| {
|
||||||
fs::create_dir_all(path.parent().unwrap())?;
|
fs::create_dir_all(path.parent().unwrap())?;
|
||||||
|
|
||||||
|
@ -71,13 +69,11 @@ where
|
||||||
|
|
||||||
pub async fn extract_zip<E>(
|
pub async fn extract_zip<E>(
|
||||||
stream: impl Stream<Item = Result<Bytes, E>> + Unpin,
|
stream: impl Stream<Item = Result<Bytes, E>> + Unpin,
|
||||||
output: &Path,
|
path: &Path,
|
||||||
) -> Result<(), BinstallError>
|
) -> Result<(), BinstallError>
|
||||||
where
|
where
|
||||||
BinstallError: From<E>,
|
BinstallError: From<E>,
|
||||||
{
|
{
|
||||||
let path = output.to_owned();
|
|
||||||
|
|
||||||
extract_impl(stream, move |mut reader| {
|
extract_impl(stream, move |mut reader| {
|
||||||
fs::create_dir_all(path.parent().unwrap())?;
|
fs::create_dir_all(path.parent().unwrap())?;
|
||||||
|
|
||||||
|
@ -88,21 +84,19 @@ where
|
||||||
// rewind it so that we can pass it to unzip
|
// rewind it so that we can pass it to unzip
|
||||||
file.rewind()?;
|
file.rewind()?;
|
||||||
|
|
||||||
unzip(file, &path)
|
unzip(file, path)
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn extract_tar_based_stream<E>(
|
pub async fn extract_tar_based_stream<E>(
|
||||||
stream: impl Stream<Item = Result<Bytes, E>> + Unpin + 'static,
|
stream: impl Stream<Item = Result<Bytes, E>> + Unpin + 'static,
|
||||||
output: &Path,
|
path: &Path,
|
||||||
fmt: TarBasedFmt,
|
fmt: TarBasedFmt,
|
||||||
) -> Result<(), BinstallError>
|
) -> Result<(), BinstallError>
|
||||||
where
|
where
|
||||||
BinstallError: From<E>,
|
BinstallError: From<E>,
|
||||||
{
|
{
|
||||||
let path = output.to_owned();
|
|
||||||
|
|
||||||
extract_impl(stream, move |reader| {
|
extract_impl(stream, move |reader| {
|
||||||
fs::create_dir_all(path.parent().unwrap())?;
|
fs::create_dir_all(path.parent().unwrap())?;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue