mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-02 18:20:03 +00:00
Refactor entry
: Avoid Arc::clone
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
119192f8ee
commit
79ec122647
1 changed files with 7 additions and 7 deletions
14
src/main.rs
14
src/main.rs
|
@ -261,7 +261,7 @@ async fn entry() -> Result<()> {
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let desired_targets = desired_targets.get().await;
|
let desired_targets = desired_targets.get().await;
|
||||||
let target = Arc::from(
|
let target: Arc<str> = Arc::from(
|
||||||
desired_targets
|
desired_targets
|
||||||
.first()
|
.first()
|
||||||
.ok_or_else(|| miette!("No viable targets found, try with `--targets`"))?
|
.ok_or_else(|| miette!("No viable targets found, try with `--targets`"))?
|
||||||
|
@ -281,9 +281,9 @@ async fn entry() -> Result<()> {
|
||||||
.map(|resolution| {
|
.map(|resolution| {
|
||||||
tokio::spawn(install(
|
tokio::spawn(install(
|
||||||
resolution,
|
resolution,
|
||||||
Arc::clone(&opts),
|
opts.clone(),
|
||||||
Arc::clone(&temp_dir_path),
|
temp_dir_path.clone(),
|
||||||
Arc::clone(&target),
|
target.clone(),
|
||||||
))
|
))
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
|
@ -291,9 +291,9 @@ async fn entry() -> Result<()> {
|
||||||
tasks
|
tasks
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|task| {
|
.map(|task| {
|
||||||
let opts = Arc::clone(&opts);
|
let opts = opts.clone();
|
||||||
let temp_dir_path = Arc::clone(&temp_dir_path);
|
let temp_dir_path = temp_dir_path.clone();
|
||||||
let target = Arc::clone(&target);
|
let target = target.clone();
|
||||||
|
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
let resolution = await_task(task).await??;
|
let resolution = await_task(task).await??;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue