Skip to content

Commit a1292bb

Browse files
committed
refactor(config)!: make toolchain_from_partial() sync
1 parent b11f321 commit a1292bb

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

src/cli/rustup_mode.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@ async fn target_list(
10971097
quiet: bool,
10981098
) -> Result<utils::ExitCode> {
10991099
// downcasting required because the toolchain files can name any toolchain
1100-
let distributable = DistributableToolchain::from_partial(toolchain, cfg).await?;
1100+
let distributable = DistributableToolchain::from_partial(toolchain, cfg)?;
11011101
common::list_items(
11021102
distributable,
11031103
|c| {
@@ -1124,7 +1124,7 @@ async fn target_add(
11241124
// isn't a feature yet.
11251125
// list_components *and* add_component would both be inappropriate for
11261126
// custom toolchains.
1127-
let distributable = DistributableToolchain::from_partial(toolchain, cfg).await?;
1127+
let distributable = DistributableToolchain::from_partial(toolchain, cfg)?;
11281128
let components = distributable.components()?;
11291129

11301130
if targets.contains(&"all".to_string()) {
@@ -1168,7 +1168,7 @@ async fn target_remove(
11681168
targets: Vec<String>,
11691169
toolchain: Option<PartialToolchainDesc>,
11701170
) -> Result<utils::ExitCode> {
1171-
let distributable = DistributableToolchain::from_partial(toolchain, cfg).await?;
1171+
let distributable = DistributableToolchain::from_partial(toolchain, cfg)?;
11721172

11731173
for target in targets {
11741174
let target = TargetTriple::new(target);
@@ -1204,7 +1204,7 @@ async fn component_list(
12041204
quiet: bool,
12051205
) -> Result<utils::ExitCode> {
12061206
// downcasting required because the toolchain files can name any toolchain
1207-
let distributable = DistributableToolchain::from_partial(toolchain, cfg).await?;
1207+
let distributable = DistributableToolchain::from_partial(toolchain, cfg)?;
12081208
common::list_items(
12091209
distributable,
12101210
|c| Some(&c.name),
@@ -1220,7 +1220,7 @@ async fn component_add(
12201220
toolchain: Option<PartialToolchainDesc>,
12211221
target: Option<String>,
12221222
) -> Result<utils::ExitCode> {
1223-
let distributable = DistributableToolchain::from_partial(toolchain, cfg).await?;
1223+
let distributable = DistributableToolchain::from_partial(toolchain, cfg)?;
12241224
let target = get_target(target, &distributable);
12251225

12261226
for component in &components {
@@ -1246,7 +1246,7 @@ async fn component_remove(
12461246
toolchain: Option<PartialToolchainDesc>,
12471247
target: Option<String>,
12481248
) -> Result<utils::ExitCode> {
1249-
let distributable = DistributableToolchain::from_partial(toolchain, cfg).await?;
1249+
let distributable = DistributableToolchain::from_partial(toolchain, cfg)?;
12501250
let target = get_target(target, &distributable);
12511251

12521252
for component in &components {
@@ -1447,7 +1447,7 @@ async fn doc(
14471447
mut topic: Option<&str>,
14481448
doc_page: &DocPage,
14491449
) -> Result<utils::ExitCode> {
1450-
let toolchain = cfg.toolchain_from_partial(toolchain).await?;
1450+
let toolchain = cfg.toolchain_from_partial(toolchain)?;
14511451

14521452
if let Ok(distributable) = DistributableToolchain::try_from(&toolchain) {
14531453
if let [_] = distributable
@@ -1508,7 +1508,7 @@ async fn man(
15081508
command: &str,
15091509
toolchain: Option<PartialToolchainDesc>,
15101510
) -> Result<utils::ExitCode> {
1511-
let toolchain = cfg.toolchain_from_partial(toolchain).await?;
1511+
let toolchain = cfg.toolchain_from_partial(toolchain)?;
15121512
let path = toolchain.man_path();
15131513
utils::assert_is_directory(&path)?;
15141514

src/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ impl<'a> Cfg<'a> {
498498
.transpose()?)
499499
}
500500

501-
pub(crate) async fn toolchain_from_partial(
501+
pub(crate) fn toolchain_from_partial(
502502
&self,
503503
toolchain: Option<PartialToolchainDesc>,
504504
) -> anyhow::Result<Toolchain<'_>> {

src/toolchain/distributable.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,11 @@ pub(crate) struct DistributableToolchain<'a> {
3333
}
3434

3535
impl<'a> DistributableToolchain<'a> {
36-
pub(crate) async fn from_partial(
36+
pub(crate) fn from_partial(
3737
toolchain: Option<PartialToolchainDesc>,
3838
cfg: &'a Cfg<'a>,
3939
) -> anyhow::Result<Self> {
40-
Ok(Self::try_from(
41-
&cfg.toolchain_from_partial(toolchain).await?,
42-
)?)
40+
Ok(Self::try_from(&cfg.toolchain_from_partial(toolchain)?)?)
4341
}
4442

4543
pub(crate) fn new(cfg: &'a Cfg<'a>, desc: ToolchainDesc) -> Result<Self, RustupError> {

0 commit comments

Comments
 (0)