Skip to content

Commit 9884cdf

Browse files
committed
Privatize internal organization of toolchain module
1 parent 54c0e23 commit 9884cdf

File tree

12 files changed

+31
-39
lines changed

12 files changed

+31
-39
lines changed

src/cli/common.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,13 @@ use crate::cli::download_tracker::DownloadTracker;
1818
use crate::currentprocess::{terminalsource, Process};
1919
use crate::dist::dist::{TargetTriple, ToolchainDesc};
2020
use crate::dist::manifest::ComponentStatus;
21+
use crate::dist::notifications as dist_notifications;
2122
use crate::install::UpdateStatus;
22-
use crate::toolchain::names::{LocalToolchainName, ToolchainName};
23-
use crate::toolchain::toolchain::Toolchain;
23+
use crate::toolchain::{DistributableToolchain, LocalToolchainName, Toolchain, ToolchainName};
2424
use crate::utils::notifications as util_notifications;
2525
use crate::utils::notify::NotificationLevel;
2626
use crate::utils::utils;
2727
use crate::{config::Cfg, notifications::Notification};
28-
use crate::{
29-
dist::notifications as dist_notifications, toolchain::distributable::DistributableToolchain,
30-
};
3128

3229
pub(crate) const WARN_COMPLETE_PROFILE: &str = "downloading with complete profile isn't recommended unless you are a developer of the rust language";
3330

src/cli/proxy_mode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::{
66
cli::{common::set_globals, job, self_update},
77
command::run_command_for_dir,
88
currentprocess::Process,
9-
toolchain::names::ResolvableLocalToolchainName,
9+
toolchain::ResolvableLocalToolchainName,
1010
};
1111

1212
#[cfg_attr(feature = "otel", tracing::instrument)]

src/cli/rustup_mode.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,9 @@ use crate::{
3131
errors::RustupError,
3232
install::{InstallMethod, UpdateStatus},
3333
toolchain::{
34-
distributable::DistributableToolchain,
35-
names::{
36-
CustomToolchainName, LocalToolchainName, MaybeResolvableToolchainName,
37-
ResolvableLocalToolchainName, ResolvableToolchainName, ToolchainName,
38-
},
39-
toolchain::Toolchain,
34+
CustomToolchainName, DistributableToolchain, LocalToolchainName,
35+
MaybeResolvableToolchainName, ResolvableLocalToolchainName, ResolvableToolchainName,
36+
Toolchain, ToolchainName,
4037
},
4138
utils::utils::{self, ExitCode},
4239
};
@@ -827,16 +824,13 @@ async fn update(cfg: &mut Cfg<'_>, opts: UpdateOpts) -> Result<utils::ExitCode>
827824
let force = opts.force;
828825
let allow_downgrade = opts.allow_downgrade;
829826
let profile = cfg.get_profile()?;
830-
let status = match crate::toolchain::distributable::DistributableToolchain::new(
831-
cfg,
832-
desc.clone(),
833-
) {
827+
let status = match DistributableToolchain::new(cfg, desc.clone()) {
834828
Ok(mut d) => {
835829
d.update_extra(&components, &targets, profile, force, allow_downgrade)
836830
.await?
837831
}
838832
Err(RustupError::ToolchainNotInstalled(_)) => {
839-
crate::toolchain::distributable::DistributableToolchain::install(
833+
DistributableToolchain::install(
840834
cfg,
841835
&desc,
842836
&components,

src/cli/self_update.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,8 @@ use crate::{
7676
dist::dist::{self, PartialToolchainDesc, Profile, TargetTriple, ToolchainDesc},
7777
install::UpdateStatus,
7878
toolchain::{
79-
distributable::DistributableToolchain,
80-
names::{MaybeOfficialToolchainName, ResolvableToolchainName, ToolchainName},
81-
toolchain::Toolchain,
79+
DistributableToolchain, MaybeOfficialToolchainName, ResolvableToolchainName, Toolchain,
80+
ToolchainName,
8281
},
8382
utils::{utils, Notification},
8483
DUP_TOOLS, TOOLS,

src/cli/setup_mode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::{
1111
},
1212
currentprocess::Process,
1313
dist::dist::Profile,
14-
toolchain::names::MaybeOfficialToolchainName,
14+
toolchain::MaybeOfficialToolchainName,
1515
utils::utils,
1616
};
1717

src/config.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,8 @@ use crate::{
2727
notifications::*,
2828
settings::{Settings, SettingsFile},
2929
toolchain::{
30-
distributable::DistributableToolchain,
31-
names::{
32-
CustomToolchainName, LocalToolchainName, PathBasedToolchainName,
33-
ResolvableLocalToolchainName, ResolvableToolchainName, ToolchainName,
34-
},
35-
toolchain::Toolchain,
30+
CustomToolchainName, DistributableToolchain, LocalToolchainName, PathBasedToolchainName,
31+
ResolvableLocalToolchainName, ResolvableToolchainName, Toolchain, ToolchainName,
3632
},
3733
utils::utils,
3834
};
@@ -877,7 +873,7 @@ impl<'a> Cfg<'a> {
877873
.filter_map(|n| ToolchainName::try_from(&n).ok())
878874
.collect();
879875

880-
crate::toolchain::names::toolchain_sort(&mut toolchains);
876+
crate::toolchain::toolchain_sort(&mut toolchains);
881877

882878
Ok(toolchains)
883879
} else {

src/dist/dist.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use crate::{
2727
prefix::InstallPrefix,
2828
},
2929
errors::RustupError,
30-
toolchain::names::ToolchainName,
30+
toolchain::ToolchainName,
3131
utils::utils,
3232
};
3333
pub static DEFAULT_DIST_SERVER: &str = "https://static.rust-lang.org";

src/dist/manifest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use serde::{Deserialize, Serialize};
2424
use super::{config::Config, dist::ToolchainDesc};
2525
use crate::dist::dist::{Profile, TargetTriple};
2626
use crate::errors::*;
27-
use crate::toolchain::distributable::DistributableToolchain;
27+
use crate::toolchain::DistributableToolchain;
2828

2929
/// Used by the `installed_components` function
3030
pub(crate) struct ComponentStatus {

src/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use url::Url;
1313
use crate::{
1414
dist::dist::{TargetTriple, ToolchainDesc},
1515
dist::manifest::{Component, Manifest},
16-
toolchain::names::{PathBasedToolchainName, ToolchainName},
16+
toolchain::{PathBasedToolchainName, ToolchainName},
1717
};
1818

1919
/// A type erasing thunk for the retry crate to permit use with anyhow. See <https://github.com/dtolnay/anyhow/issues/149>

src/install.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ use crate::{
99
dist::{dist, download::DownloadCfg, prefix::InstallPrefix, Notification},
1010
errors::RustupError,
1111
notifications::Notification as RootNotification,
12-
toolchain::{
13-
names::{CustomToolchainName, LocalToolchainName},
14-
toolchain::Toolchain,
15-
},
12+
toolchain::{CustomToolchainName, LocalToolchainName, Toolchain},
1613
utils::utils,
1714
};
1815

0 commit comments

Comments
 (0)