mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-07 20:50:03 +00:00
Refactor: Reduce params of install_from_package
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
5bdffd9178
commit
1ebd4bdb75
1 changed files with 8 additions and 12 deletions
20
src/main.rs
20
src/main.rs
|
@ -576,10 +576,13 @@ async fn install(
|
||||||
bin_path,
|
bin_path,
|
||||||
bin_files,
|
bin_files,
|
||||||
} => {
|
} => {
|
||||||
install_from_package(
|
let cvs = metafiles::CrateVersionSource {
|
||||||
fetcher, opts, package, name, temp_dir, version, bin_path, bin_files,
|
name,
|
||||||
)
|
version: package.version.parse().into_diagnostic()?,
|
||||||
.await
|
source: metafiles::Source::cratesio_registry(),
|
||||||
|
};
|
||||||
|
|
||||||
|
install_from_package(fetcher, opts, cvs, temp_dir, version, bin_path, bin_files).await
|
||||||
}
|
}
|
||||||
Resolution::InstallFromSource { package } => {
|
Resolution::InstallFromSource { package } => {
|
||||||
let desired_targets = desired_targets.get().await;
|
let desired_targets = desired_targets.get().await;
|
||||||
|
@ -604,8 +607,7 @@ async fn install(
|
||||||
async fn install_from_package(
|
async fn install_from_package(
|
||||||
fetcher: Arc<dyn Fetcher>,
|
fetcher: Arc<dyn Fetcher>,
|
||||||
opts: Arc<Options>,
|
opts: Arc<Options>,
|
||||||
package: Package<Meta>,
|
cvs: metafiles::CrateVersionSource,
|
||||||
name: String,
|
|
||||||
temp_dir: Arc<Path>,
|
temp_dir: Arc<Path>,
|
||||||
version: String,
|
version: String,
|
||||||
bin_path: PathBuf,
|
bin_path: PathBuf,
|
||||||
|
@ -647,12 +649,6 @@ async fn install_from_package(
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
let cvs = metafiles::CrateVersionSource {
|
|
||||||
name: name.clone(),
|
|
||||||
version: package.version.parse().into_diagnostic()?,
|
|
||||||
source: metafiles::Source::cratesio_registry(),
|
|
||||||
};
|
|
||||||
|
|
||||||
info!("Installing binaries...");
|
info!("Installing binaries...");
|
||||||
block_in_place(|| {
|
block_in_place(|| {
|
||||||
for file in &bin_files {
|
for file in &bin_files {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue