Skip to content

Commit 35285c9

Browse files
committed
fix(rustup-mode): improve clap error format
1 parent 20a1c81 commit 35285c9

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/cli/rustup_mode.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ pub async fn main(current_dir: PathBuf, process: &Process) -> Result<utils::Exit
529529

530530
use clap::error::ErrorKind::*;
531531
let matches = match Rustup::try_parse_from(process.args_os()) {
532-
Ok(matches) => Ok(matches),
532+
Ok(matches) => matches,
533533
Err(err) if err.kind() == DisplayHelp => {
534534
write!(process.stdout().lock(), "{err}")?;
535535
return Ok(utils::ExitCode(0));
@@ -554,15 +554,12 @@ pub async fn main(current_dir: PathBuf, process: &Process) -> Result<utils::Exit
554554
.contains(&err.kind())
555555
{
556556
write!(process.stdout().lock(), "{err}")?;
557-
return Ok(utils::ExitCode(1));
558-
}
559-
if err.kind() == ValueValidation && err.to_string().contains(TOOLCHAIN_OVERRIDE_ERROR) {
557+
} else {
560558
write!(process.stderr().lock(), "{err}")?;
561-
return Ok(utils::ExitCode(1));
562559
}
563-
Err(err)
560+
return Ok(utils::ExitCode(1));
564561
}
565-
}?;
562+
};
566563

567564
let cfg = &mut common::set_globals(current_dir, matches.verbose, matches.quiet, process)?;
568565

0 commit comments

Comments
 (0)