Skip to content

Commit 1754da3

Browse files
djcrami3l
authored andcommitted
Rename temp::Cfg to Context
1 parent c6cbab6 commit 1754da3

File tree

11 files changed

+221
-231
lines changed

11 files changed

+221
-231
lines changed

src/cli/rustup_mode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ fn update(cfg: &mut Cfg, m: &ArgMatches) -> Result<utils::ExitCode> {
10081008
common::update_all_channels(cfg, self_update, m.get_flag("force"))?;
10091009
info!("cleaning up downloads & tmp directories");
10101010
utils::delete_dir_contents_following_links(&cfg.download_dir);
1011-
cfg.temp_cfg.clean();
1011+
cfg.tmp_cx.clean();
10121012
}
10131013

10141014
if !self_update::NEVER_SELF_UPDATE && self_update_mode == SelfUpdateMode::CheckOnly {

src/config.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ pub(crate) struct Cfg {
179179
pub toolchains_dir: PathBuf,
180180
pub update_hash_dir: PathBuf,
181181
pub download_dir: PathBuf,
182-
pub temp_cfg: temp::Cfg,
182+
pub tmp_cx: temp::Context,
183183
pub toolchain_override: Option<ResolvableToolchainName>,
184184
pub env_override: Option<LocalToolchainName>,
185185
pub dist_root_url: String,
@@ -241,7 +241,7 @@ impl Cfg {
241241
};
242242

243243
let notify_clone = notify_handler.clone();
244-
let temp_cfg = temp::Cfg::new(
244+
let tmp_cx = temp::Context::new(
245245
rustup_dir.join("tmp"),
246246
dist_root_server.as_str(),
247247
Box::new(move |n| (notify_clone)(n.into())),
@@ -256,7 +256,7 @@ impl Cfg {
256256
toolchains_dir,
257257
update_hash_dir,
258258
download_dir,
259-
temp_cfg,
259+
tmp_cx,
260260
notify_handler,
261261
toolchain_override: None,
262262
env_override,
@@ -281,7 +281,7 @@ impl Cfg {
281281
) -> DownloadCfg<'a> {
282282
DownloadCfg {
283283
dist_root: &self.dist_root_url,
284-
temp_cfg: &self.temp_cfg,
284+
tmp_cx: &self.tmp_cx,
285285
download_dir: &self.download_dir,
286286
notify_handler,
287287
}
@@ -961,7 +961,7 @@ impl Debug for Cfg {
961961
.field("toolchains_dir", &self.toolchains_dir)
962962
.field("update_hash_dir", &self.update_hash_dir)
963963
.field("download_dir", &self.download_dir)
964-
.field("temp_cfg", &self.temp_cfg)
964+
.field("tmp_cx", &self.tmp_cx)
965965
.field("toolchain_override", &self.toolchain_override)
966966
.field("env_override", &self.env_override)
967967
.field("dist_root_url", &self.dist_root_url)

src/dist/component/package.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,10 @@ pub(crate) struct TarPackage<'a>(DirectoryPackage, temp::Dir<'a>);
143143
impl<'a> TarPackage<'a> {
144144
pub(crate) fn new<R: Read>(
145145
stream: R,
146-
temp_cfg: &'a temp::Cfg,
146+
tmp_cx: &'a temp::Context,
147147
notify_handler: Option<&'a dyn Fn(Notification<'_>)>,
148148
) -> Result<Self> {
149-
let temp_dir = temp_cfg.new_directory()?;
149+
let temp_dir = tmp_cx.new_directory()?;
150150
let mut archive = tar::Archive::new(stream);
151151
// The rust-installer packages unpack to a directory called
152152
// $pkgname-$version-$target. Skip that directory when
@@ -555,13 +555,13 @@ pub(crate) struct TarGzPackage<'a>(TarPackage<'a>);
555555
impl<'a> TarGzPackage<'a> {
556556
pub(crate) fn new<R: Read>(
557557
stream: R,
558-
temp_cfg: &'a temp::Cfg,
558+
tmp_cx: &'a temp::Context,
559559
notify_handler: Option<&'a dyn Fn(Notification<'_>)>,
560560
) -> Result<Self> {
561561
let stream = flate2::read::GzDecoder::new(stream);
562562
Ok(TarGzPackage(TarPackage::new(
563563
stream,
564-
temp_cfg,
564+
tmp_cx,
565565
notify_handler,
566566
)?))
567567
}
@@ -591,13 +591,13 @@ pub(crate) struct TarXzPackage<'a>(TarPackage<'a>);
591591
impl<'a> TarXzPackage<'a> {
592592
pub(crate) fn new<R: Read>(
593593
stream: R,
594-
temp_cfg: &'a temp::Cfg,
594+
tmp_cx: &'a temp::Context,
595595
notify_handler: Option<&'a dyn Fn(Notification<'_>)>,
596596
) -> Result<Self> {
597597
let stream = xz2::read::XzDecoder::new(stream);
598598
Ok(TarXzPackage(TarPackage::new(
599599
stream,
600-
temp_cfg,
600+
tmp_cx,
601601
notify_handler,
602602
)?))
603603
}
@@ -627,13 +627,13 @@ pub(crate) struct TarZStdPackage<'a>(TarPackage<'a>);
627627
impl<'a> TarZStdPackage<'a> {
628628
pub(crate) fn new<R: Read>(
629629
stream: R,
630-
temp_cfg: &'a temp::Cfg,
630+
tmp_cx: &'a temp::Context,
631631
notify_handler: Option<&'a dyn Fn(Notification<'_>)>,
632632
) -> Result<Self> {
633633
let stream = zstd::stream::read::Decoder::new(stream)?;
634634
Ok(TarZStdPackage(TarPackage::new(
635635
stream,
636-
temp_cfg,
636+
tmp_cx,
637637
notify_handler,
638638
)?))
639639
}

0 commit comments

Comments
 (0)