diff options
| author | bors <bors@rust-lang.org> | 2020-11-06 16:12:13 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-11-06 16:12:13 +0000 |
| commit | 7e9a36fa8a4ec06daec581e23f390389e05f25e4 (patch) | |
| tree | afe67d3f71142bcd9766b5f6480c994017da6519 /src/bootstrap/setup.rs | |
| parent | dc06a36074f04c6a77b5834f2950011d49607898 (diff) | |
| parent | af50c796faaf68adf01eb16afe86f368a64cc906 (diff) | |
| download | rust-7e9a36fa8a4ec06daec581e23f390389e05f25e4.tar.gz rust-7e9a36fa8a4ec06daec581e23f390389e05f25e4.zip | |
Auto merge of #78810 - JohnTitor:rollup-8fhtvxu, r=JohnTitor
Rollup of 15 pull requests Successful merges: - #74979 (`#![deny(unsafe_op_in_unsafe_fn)]` in sys/hermit) - #78006 (Use Intra-doc links for std::io::buffered) - #78167 (Fix unreachable sub-branch detection in or-patterns) - #78514 (Allow using 1/2/3/4 for `x.py setup` options) - #78538 (BTreeMap: document a curious assumption in test cases) - #78559 (Add LLVM upgrades from 7 to 10 to RELEASES.md) - #78666 (Fix shellcheck error) - #78705 (Print a summary of which test suite failed) - #78726 (Add link to rust website) - #78730 (Expand explanation of reverse_bits) - #78760 (`deny(invalid_codeblock_attributes)` for rustc_error_codes) - #78771 (inliner: Copy unevaluated constants only after successful inlining) - #78794 (rustc_expand: use collect_bang helper instead of manual reimplementation) - #78795 (The renumber pass is long gone) - #78798 (Fixing Spelling Typos) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src/bootstrap/setup.rs')
| -rw-r--r-- | src/bootstrap/setup.rs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/bootstrap/setup.rs b/src/bootstrap/setup.rs index f5ce45a5bd1..55d2445fc49 100644 --- a/src/bootstrap/setup.rs +++ b/src/bootstrap/setup.rs @@ -127,14 +127,17 @@ pub fn setup(src_path: &Path, profile: Profile) { // Used to get the path for `Subcommand::Setup` pub fn interactive_path() -> io::Result<Profile> { - fn abbrev_all() -> impl Iterator<Item = (String, Profile)> { - ('a'..).map(|c| c.to_string()).zip(Profile::all()) + fn abbrev_all() -> impl Iterator<Item = ((String, String), Profile)> { + ('a'..) + .zip(1..) + .map(|(letter, number)| (letter.to_string(), number.to_string())) + .zip(Profile::all()) } fn parse_with_abbrev(input: &str) -> Result<Profile, String> { let input = input.trim().to_lowercase(); - for (letter, profile) in abbrev_all() { - if input == letter { + for ((letter, number), profile) in abbrev_all() { + if input == letter || input == number { return Ok(profile); } } @@ -142,13 +145,13 @@ pub fn interactive_path() -> io::Result<Profile> { } println!("Welcome to the Rust project! What do you want to do with x.py?"); - for (letter, profile) in abbrev_all() { + for ((letter, _), profile) in abbrev_all() { println!("{}) {}: {}", letter, profile, profile.purpose()); } let template = loop { print!( "Please choose one ({}): ", - abbrev_all().map(|(l, _)| l).collect::<Vec<_>>().join("/") + abbrev_all().map(|((l, _), _)| l).collect::<Vec<_>>().join("/") ); io::stdout().flush()?; let mut input = String::new(); |
