mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-20 20:48:43 +00:00
Optimize DesiredTargets
: Avoid mem alloc on clone
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
d58f340a45
commit
758dab7d4f
1 changed files with 2 additions and 2 deletions
|
@ -11,7 +11,7 @@ pub const TARGET: &str = env!("TARGET");
|
|||
#[derive(Debug, Clone)]
|
||||
enum DesiredTargetsInner {
|
||||
AutoDetect(Arc<OnceCell<Vec<String>>>),
|
||||
Initialized(Vec<String>),
|
||||
Initialized(Arc<Vec<String>>),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
@ -19,7 +19,7 @@ pub struct DesiredTargets(DesiredTargetsInner);
|
|||
|
||||
impl DesiredTargets {
|
||||
fn initialized(targets: Vec<String>) -> Self {
|
||||
Self(DesiredTargetsInner::Initialized(targets))
|
||||
Self(DesiredTargetsInner::Initialized(Arc::new(targets)))
|
||||
}
|
||||
|
||||
fn auto_detect() -> Self {
|
||||
|
|
Loading…
Add table
Reference in a new issue