From eb00a97b8c584392ff61d7258644f2a73215532a Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Wed, 28 Apr 2021 00:34:15 +0800 Subject: [PATCH 1/3] Add the missing tools for valid_proxy_names --- src/cli/errors.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cli/errors.rs b/src/cli/errors.rs index c6f413c55b..7eecff9ae7 100644 --- a/src/cli/errors.rs +++ b/src/cli/errors.rs @@ -13,7 +13,7 @@ use strsim::damerau_levenshtein; use super::rustup_mode::CompletionCommand; use crate::dist::temp; -use crate::TOOLS; +use crate::{TOOLS, DUP_TOOLS}; error_chain! { links { @@ -85,7 +85,7 @@ error_chain! { fn valid_proxy_names() -> String { TOOLS - .iter() + .iter().chain(DUP_TOOLS.iter()) .map(|s| format!("'{}'", s)) .collect::>() .join(", ") From ac06f3e003e96820a97674564dc12ff557e7f21b Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Wed, 28 Apr 2021 00:42:16 +0800 Subject: [PATCH 2/3] Fmt and fix the test --- src/bin/rustup-init.rs | 9 +++++++-- src/cli/errors.rs | 5 +++-- tests/cli-misc.rs | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/bin/rustup-init.rs b/src/bin/rustup-init.rs index bde4df542a..2b658bc19e 100644 --- a/src/bin/rustup-init.rs +++ b/src/bin/rustup-init.rs @@ -28,7 +28,7 @@ use rustup::cli::setup_mode; use rustup::currentprocess::{process, with, OSProcess}; use rustup::env_var::RUST_RECURSION_COUNT_MAX; use rustup::utils::utils; -use rustup::{TOOLS, DUP_TOOLS}; +use rustup::{DUP_TOOLS, TOOLS}; fn main() { let process = OSProcess::default(); @@ -94,7 +94,12 @@ fn run_rustup_inner() -> Result { } } Some(n) => { - if TOOLS.iter().chain(DUP_TOOLS.iter()).find(|&&name| name == n).is_some() { + if TOOLS + .iter() + .chain(DUP_TOOLS.iter()) + .find(|&&name| name == n) + .is_some() + { proxy_mode::main() } else { Err(ErrorKind::UnknownProxyName(n.to_string()).into()) diff --git a/src/cli/errors.rs b/src/cli/errors.rs index 7eecff9ae7..2ee78e9e2f 100644 --- a/src/cli/errors.rs +++ b/src/cli/errors.rs @@ -13,7 +13,7 @@ use strsim::damerau_levenshtein; use super::rustup_mode::CompletionCommand; use crate::dist::temp; -use crate::{TOOLS, DUP_TOOLS}; +use crate::{DUP_TOOLS, TOOLS}; error_chain! { links { @@ -85,7 +85,8 @@ error_chain! { fn valid_proxy_names() -> String { TOOLS - .iter().chain(DUP_TOOLS.iter()) + .iter() + .chain(DUP_TOOLS.iter()) .map(|s| format!("'{}'", s)) .collect::>() .join(", ") diff --git a/tests/cli-misc.rs b/tests/cli-misc.rs index 20f1287902..ae41295ee1 100644 --- a/tests/cli-misc.rs +++ b/tests/cli-misc.rs @@ -325,7 +325,7 @@ fn rustup_failed_path_search() { expect_err( config, broken, - &format!("unknown proxy name: 'fake_proxy'; valid proxy names are 'rustc', 'rustdoc', 'cargo', 'rust-lldb', 'rust-gdb', 'rls', 'cargo-clippy', 'clippy-driver', 'cargo-miri'",), + &format!("unknown proxy name: 'fake_proxy'; valid proxy names are 'rustc', 'rustdoc', 'cargo', 'rust-lldb', 'rust-gdb', 'rls', 'cargo-clippy', 'clippy-driver', 'cargo-miri', 'rustfmt', 'cargo-fmt'",), ); // Hardlink will be automatically cleaned up by test setup code From 0bb25b654ca339c58d749b4952583cc3d606d042 Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Wed, 28 Apr 2021 00:47:51 +0800 Subject: [PATCH 3/3] Make clippy happy --- tests/cli-misc.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cli-misc.rs b/tests/cli-misc.rs index ae41295ee1..25212f93bc 100644 --- a/tests/cli-misc.rs +++ b/tests/cli-misc.rs @@ -325,7 +325,7 @@ fn rustup_failed_path_search() { expect_err( config, broken, - &format!("unknown proxy name: 'fake_proxy'; valid proxy names are 'rustc', 'rustdoc', 'cargo', 'rust-lldb', 'rust-gdb', 'rls', 'cargo-clippy', 'clippy-driver', 'cargo-miri', 'rustfmt', 'cargo-fmt'",), + &"unknown proxy name: 'fake_proxy'; valid proxy names are 'rustc', 'rustdoc', 'cargo', 'rust-lldb', 'rust-gdb', 'rls', 'cargo-clippy', 'clippy-driver', 'cargo-miri', 'rustfmt', 'cargo-fmt'".to_string(), ); // Hardlink will be automatically cleaned up by test setup code