Skip to content

Commit e17cfec

Browse files
committed
feat(config)!: use Cfg::get_profile() for unspecified profile in ensure_installed()
1 parent 12c3432 commit e17cfec

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/config.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -787,24 +787,26 @@ impl<'a> Cfg<'a> {
787787
) -> Result<Toolchain<'_>> {
788788
let components: Vec<_> = components.iter().map(AsRef::as_ref).collect();
789789
let targets: Vec<_> = targets.iter().map(AsRef::as_ref).collect();
790+
let profile = match profile {
791+
Some(profile) => profile,
792+
None => self.get_profile()?,
793+
};
790794
let toolchain = match DistributableToolchain::new(self, toolchain.clone()) {
791795
Err(RustupError::ToolchainNotInstalled(_)) => {
792796
DistributableToolchain::install(
793797
self,
794798
&toolchain,
795799
&components,
796800
&targets,
797-
profile.unwrap_or(Profile::Default),
801+
profile,
798802
false,
799803
)
800804
.await?
801805
.1
802806
}
803807
Ok(mut distributable) => {
804808
if !distributable.components_exist(&components, &targets)? {
805-
distributable
806-
.update(&components, &targets, profile.unwrap_or(Profile::Default))
807-
.await?;
809+
distributable.update(&components, &targets, profile).await?;
808810
}
809811
distributable
810812
}

0 commit comments

Comments
 (0)