Skip to content

Commit 42636d5

Browse files
committed
refactor(distributable)!: avoid unnecessary clones
1 parent fffd850 commit 42636d5

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/cli/rustup_mode.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ async fn default_(
718718
MaybeResolvableToolchainName::Some(ResolvableToolchainName::Official(toolchain)) => {
719719
let desc = toolchain.resolve(&cfg.get_default_host_triple()?)?;
720720
let status = cfg
721-
.ensure_installed(desc.clone(), vec![], vec![], None, true)
721+
.ensure_installed(&desc, vec![], vec![], None, true)
722722
.await?
723723
.0;
724724

src/config.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ impl<'a> Cfg<'a> {
752752
profile,
753753
} => {
754754
let toolchain = self
755-
.ensure_installed(toolchain, components, targets, profile, false)
755+
.ensure_installed(&toolchain, components, targets, profile, false)
756756
.await?
757757
.1;
758758
Ok((toolchain, reason))
@@ -768,7 +768,7 @@ impl<'a> Cfg<'a> {
768768
Some(ToolchainName::Official(toolchain_desc)) => {
769769
let reason = ActiveReason::Default;
770770
let toolchain = self
771-
.ensure_installed(toolchain_desc, vec![], vec![], None, false)
771+
.ensure_installed(&toolchain_desc, vec![], vec![], None, false)
772772
.await?
773773
.1;
774774
Ok((toolchain, reason))
@@ -782,14 +782,14 @@ impl<'a> Cfg<'a> {
782782
#[tracing::instrument(level = "trace", err(level = "trace"), skip_all)]
783783
pub(crate) async fn ensure_installed(
784784
&self,
785-
toolchain: ToolchainDesc,
785+
toolchain: &ToolchainDesc,
786786
components: Vec<String>,
787787
targets: Vec<String>,
788788
profile: Option<Profile>,
789789
verbose: bool,
790790
) -> Result<(UpdateStatus, Toolchain<'_>)> {
791791
if verbose {
792-
(self.notify_handler)(Notification::LookingForToolchain(&toolchain));
792+
(self.notify_handler)(Notification::LookingForToolchain(toolchain));
793793
}
794794
let components: Vec<_> = components.iter().map(AsRef::as_ref).collect();
795795
let targets: Vec<_> = targets.iter().map(AsRef::as_ref).collect();
@@ -798,7 +798,7 @@ impl<'a> Cfg<'a> {
798798
Err(RustupError::ToolchainNotInstalled(_)) => {
799799
DistributableToolchain::install(
800800
self,
801-
&toolchain,
801+
toolchain,
802802
&components,
803803
&targets,
804804
profile,
@@ -808,7 +808,7 @@ impl<'a> Cfg<'a> {
808808
}
809809
Ok(mut distributable) => {
810810
if verbose {
811-
(self.notify_handler)(Notification::UsingExistingToolchain(&toolchain));
811+
(self.notify_handler)(Notification::UsingExistingToolchain(toolchain));
812812
}
813813
let status = if !distributable.components_exist(&components, &targets)? {
814814
distributable.update(&components, &targets, profile).await?

0 commit comments

Comments
 (0)