Skip to content

Commit 67b97db

Browse files
djcrami3l
authored andcommitted
cli: rename CLIError to CliError
1 parent 4d55397 commit 67b97db

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

src/bin/rustup-init.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ async fn run_rustup_inner(
124124
}
125125
None => {
126126
// Weird case. No arg0, or it's unparsable.
127-
Err(rustup::cli::errors::CLIError::NoExeName.into())
127+
Err(rustup::cli::errors::CliError::NoExeName.into())
128128
}
129129
}
130130
}

src/cli/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use strsim::damerau_levenshtein;
1010
use thiserror::Error as ThisError;
1111

1212
#[derive(ThisError, Debug)]
13-
pub enum CLIError {
13+
pub enum CliError {
1414
#[error("couldn't determine self executable name")]
1515
NoExeName,
1616
#[error("rustup is not installed at '{}'", .p.display())]

src/cli/rustup_mode.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use tracing_subscriber::{EnvFilter, Registry, reload::Handle};
2626
use crate::{
2727
cli::{
2828
common::{self, PackageUpdate, update_console_filter},
29-
errors::CLIError,
29+
errors::CliError,
3030
help::*,
3131
self_update::{self, SelfUpdateMode, check_rustup_update},
3232
topical_doc,
@@ -1805,7 +1805,7 @@ fn set_auto_self_update(
18051805
let arg0 = arg0
18061806
.as_ref()
18071807
.and_then(|a| a.to_str())
1808-
.ok_or(CLIError::NoExeName)?;
1808+
.ok_or(CliError::NoExeName)?;
18091809
warn!(
18101810
"{} is built with the no-self-update feature: setting auto-self-update will not have any effect.",
18111811
arg0

src/cli/self_update.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ pub(crate) fn uninstall(no_prompt: bool, process: &Process) -> Result<utils::Exi
978978
let cargo_home = process.cargo_home()?;
979979

980980
if !cargo_home.join(format!("bin/rustup{EXE_SUFFIX}")).exists() {
981-
return Err(CLIError::NotSelfInstalled { p: cargo_home }.into());
981+
return Err(CliError::NotSelfInstalled { p: cargo_home }.into());
982982
}
983983

984984
if !no_prompt {
@@ -1010,12 +1010,12 @@ pub(crate) fn uninstall(no_prompt: bool, process: &Process) -> Result<utils::Exi
10101010
// Delete everything in CARGO_HOME *except* the rustup bin
10111011

10121012
// First everything except the bin directory
1013-
let diriter = fs::read_dir(&cargo_home).map_err(|e| CLIError::ReadDirError {
1013+
let diriter = fs::read_dir(&cargo_home).map_err(|e| CliError::ReadDirError {
10141014
p: cargo_home.clone(),
10151015
source: e,
10161016
})?;
10171017
for dirent in diriter {
1018-
let dirent = dirent.map_err(|e| CLIError::ReadDirError {
1018+
let dirent = dirent.map_err(|e| CliError::ReadDirError {
10191019
p: cargo_home.clone(),
10201020
source: e,
10211021
})?;
@@ -1036,12 +1036,12 @@ pub(crate) fn uninstall(no_prompt: bool, process: &Process) -> Result<utils::Exi
10361036
.map(|t| format!("{t}{EXE_SUFFIX}"));
10371037
let tools: Vec<_> = tools.chain(vec![format!("rustup{EXE_SUFFIX}")]).collect();
10381038
let bin_dir = cargo_home.join("bin");
1039-
let diriter = fs::read_dir(&bin_dir).map_err(|e| CLIError::ReadDirError {
1039+
let diriter = fs::read_dir(&bin_dir).map_err(|e| CliError::ReadDirError {
10401040
p: bin_dir.clone(),
10411041
source: e,
10421042
})?;
10431043
for dirent in diriter {
1044-
let dirent = dirent.map_err(|e| CLIError::ReadDirError {
1044+
let dirent = dirent.map_err(|e| CliError::ReadDirError {
10451045
p: bin_dir.clone(),
10461046
source: e,
10471047
})?;
@@ -1227,7 +1227,7 @@ pub(crate) async fn prepare_update(dl_cfg: &DownloadCfg<'_>) -> Result<Option<Pa
12271227
let setup_path = cargo_home.join(format!("bin{MAIN_SEPARATOR}rustup-init{EXE_SUFFIX}"));
12281228

12291229
if !rustup_path.exists() {
1230-
return Err(CLIError::NotSelfInstalled { p: cargo_home }.into());
1230+
return Err(CliError::NotSelfInstalled { p: cargo_home }.into());
12311231
}
12321232

12331233
if setup_path.exists() {

src/cli/self_update/windows.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ pub fn complete_windows_uninstall(process: &Process) -> Result<utils::ExitCode>
375375
.stdout(Stdio::null())
376376
.stderr(Stdio::null())
377377
.spawn()
378-
.context(CLIError::WindowsUninstallMadness)?;
378+
.context(CliError::WindowsUninstallMadness)?;
379379

380380
Ok(utils::ExitCode(0))
381381
}
@@ -398,7 +398,7 @@ pub(crate) fn wait_for_parent() -> Result<()> {
398398
let snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
399399
if snapshot == INVALID_HANDLE_VALUE {
400400
let err = io::Error::last_os_error();
401-
return Err(err).context(CLIError::WindowsUninstallMadness);
401+
return Err(err).context(CliError::WindowsUninstallMadness);
402402
}
403403

404404
let snapshot = scopeguard::guard(snapshot, |h| {
@@ -412,15 +412,15 @@ pub(crate) fn wait_for_parent() -> Result<()> {
412412
let success = Process32First(*snapshot, &mut entry);
413413
if success == 0 {
414414
let err = io::Error::last_os_error();
415-
return Err(err).context(CLIError::WindowsUninstallMadness);
415+
return Err(err).context(CliError::WindowsUninstallMadness);
416416
}
417417

418418
let this_pid = GetCurrentProcessId();
419419
while entry.th32ProcessID != this_pid {
420420
let success = Process32Next(*snapshot, &mut entry);
421421
if success == 0 {
422422
let err = io::Error::last_os_error();
423-
return Err(err).context(CLIError::WindowsUninstallMadness);
423+
return Err(err).context(CliError::WindowsUninstallMadness);
424424
}
425425
}
426426

@@ -445,7 +445,7 @@ pub(crate) fn wait_for_parent() -> Result<()> {
445445

446446
if res != WAIT_OBJECT_0 {
447447
let err = io::Error::last_os_error();
448-
return Err(err).context(CLIError::WindowsUninstallMadness);
448+
return Err(err).context(CliError::WindowsUninstallMadness);
449449
}
450450
}
451451

@@ -514,7 +514,7 @@ fn get_windows_path_var() -> Result<Option<HSTRING>> {
514514
Ok(None)
515515
}
516516
Err(e) if e.code() == HRESULT::from_win32(ERROR_FILE_NOT_FOUND) => Ok(Some(HSTRING::new())),
517-
Err(e) => Err(e).context(CLIError::WindowsUninstallMadness),
517+
Err(e) => Err(e).context(CliError::WindowsUninstallMadness),
518518
}
519519
}
520520

@@ -731,7 +731,7 @@ pub(crate) fn delete_rustup_and_cargo_home(process: &Process) -> Result<()> {
731731

732732
if gc_handle == INVALID_HANDLE_VALUE {
733733
let err = io::Error::last_os_error();
734-
return Err(err).context(CLIError::WindowsUninstallMadness);
734+
return Err(err).context(CliError::WindowsUninstallMadness);
735735
}
736736

737737
scopeguard::guard(gc_handle, |h| {
@@ -741,7 +741,7 @@ pub(crate) fn delete_rustup_and_cargo_home(process: &Process) -> Result<()> {
741741

742742
Command::new(gc_exe)
743743
.spawn()
744-
.context(CLIError::WindowsUninstallMadness)?;
744+
.context(CliError::WindowsUninstallMadness)?;
745745

746746
// The catch 22 article says we must sleep here to give
747747
// Windows a chance to bump the processes file reference

0 commit comments

Comments
 (0)