mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-07 12:40:04 +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_files,
|
||||
} => {
|
||||
install_from_package(
|
||||
fetcher, opts, package, name, temp_dir, version, bin_path, bin_files,
|
||||
)
|
||||
.await
|
||||
let cvs = metafiles::CrateVersionSource {
|
||||
name,
|
||||
version: package.version.parse().into_diagnostic()?,
|
||||
source: metafiles::Source::cratesio_registry(),
|
||||
};
|
||||
|
||||
install_from_package(fetcher, opts, cvs, temp_dir, version, bin_path, bin_files).await
|
||||
}
|
||||
Resolution::InstallFromSource { package } => {
|
||||
let desired_targets = desired_targets.get().await;
|
||||
|
@ -604,8 +607,7 @@ async fn install(
|
|||
async fn install_from_package(
|
||||
fetcher: Arc<dyn Fetcher>,
|
||||
opts: Arc<Options>,
|
||||
package: Package<Meta>,
|
||||
name: String,
|
||||
cvs: metafiles::CrateVersionSource,
|
||||
temp_dir: Arc<Path>,
|
||||
version: String,
|
||||
bin_path: PathBuf,
|
||||
|
@ -647,12 +649,6 @@ async fn install_from_package(
|
|||
return Ok(());
|
||||
}
|
||||
|
||||
let cvs = metafiles::CrateVersionSource {
|
||||
name: name.clone(),
|
||||
version: package.version.parse().into_diagnostic()?,
|
||||
source: metafiles::Source::cratesio_registry(),
|
||||
};
|
||||
|
||||
info!("Installing binaries...");
|
||||
block_in_place(|| {
|
||||
for file in &bin_files {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue