Skip to content

Commit c37df44

Browse files
committed
refactor(distributable)!: avoid unnecessary clones
1 parent b834834 commit c37df44

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/cli/rustup_mode.rs

Lines changed: 1 addition & 1 deletion
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

Lines changed: 6 additions & 6 deletions
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();
@@ -801,7 +801,7 @@ impl<'a> Cfg<'a> {
801801
Err(RustupError::ToolchainNotInstalled(_)) => {
802802
DistributableToolchain::install(
803803
self,
804-
&toolchain,
804+
toolchain,
805805
&components,
806806
&targets,
807807
profile,
@@ -811,7 +811,7 @@ impl<'a> Cfg<'a> {
811811
}
812812
Ok(mut distributable) => {
813813
if verbose {
814-
(self.notify_handler)(Notification::UsingExistingToolchain(&toolchain));
814+
(self.notify_handler)(Notification::UsingExistingToolchain(toolchain));
815815
}
816816
let status = if !distributable.components_exist(&components, &targets)? {
817817
distributable.update(&components, &targets, profile).await?

0 commit comments

Comments
 (0)