diff options
| author | bors <bors@rust-lang.org> | 2019-12-23 02:47:52 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-12-23 02:47:52 +0000 |
| commit | a916ac22b9f7f1f0f7aba0a41a789b3ecd765018 (patch) | |
| tree | 139cba4184f0f290fdbdff1aa0aa68352b16ccbb /src/libtest/cli.rs | |
| parent | 9b98af84c4aa66392236fff59c86da2130d46d46 (diff) | |
| parent | 0f24ccd21d9f734a21daaf3566900127167556d1 (diff) | |
Auto merge of #67540 - Mark-Simulacrum:fmt-the-world, r=Centril
Format the world This PR modifies the formatting infrastructure a bit in the first commit (to enable the forgotten 2018 edition), as well as removes most directories from the ignore list in rustfmt.toml. It then follows that up with the second commit which runs `x.py fmt` and formats the entire repository. We continue to not format the test directory (`src/test`) because of interactions with pretty printing and, in part, because re-blessing all of those files is somewhat harder to review, so is best suited for a follow up PR in my opinion.
Diffstat (limited to 'src/libtest/cli.rs')
| -rw-r--r-- | src/libtest/cli.rs | 46 |
1 files changed, 14 insertions, 32 deletions
diff --git a/src/libtest/cli.rs b/src/libtest/cli.rs index c97cb0e0605..ea6d632f48a 100644 --- a/src/libtest/cli.rs +++ b/src/libtest/cli.rs @@ -1,12 +1,12 @@ //! Module converting command-line arguments into test configuration. +use getopts; use std::env; use std::path::PathBuf; -use getopts; -use super::options::{RunIgnored, ColorConfig, OutputFormat, Options}; -use super::time::TestTimeOptions; use super::helpers::isatty; +use super::options::{ColorConfig, Options, OutputFormat, RunIgnored}; +use super::time::TestTimeOptions; #[derive(Debug)] pub struct TestOpts { @@ -86,11 +86,7 @@ fn optgroups() -> getopts::Options { "Display one character per test instead of one line. \ Alias to --format=terse", ) - .optflag( - "", - "exact", - "Exactly match filters rather than by substring", - ) + .optflag("", "exact", "Exactly match filters rather than by substring") .optopt( "", "color", @@ -109,11 +105,7 @@ fn optgroups() -> getopts::Options { json = Output a json document", "pretty|terse|json", ) - .optflag( - "", - "show-output", - "Show captured stdout of successful tests" - ) + .optflag("", "show-output", "Show captured stdout of successful tests") .optopt( "Z", "", @@ -135,7 +127,7 @@ fn optgroups() -> getopts::Options { Expected format of environment variable is `VARIABLE=WARN_TIME,CRITICAL_TIME`. Not available for --format=terse", - "plain|colored" + "plain|colored", ) .optflag( "", @@ -149,7 +141,7 @@ fn optgroups() -> getopts::Options { Expected format of environment variable is `VARIABLE=WARN_TIME,CRITICAL_TIME`. `CRITICAL_TIME` here means the limit that should not be exceeded by test. - " + ", ); opts } @@ -293,8 +285,8 @@ fn is_nightly() -> bool { // Gets the CLI options assotiated with `report-time` feature. fn get_time_options( matches: &getopts::Matches, - allow_unstable: bool) --> OptPartRes<Option<TestTimeOptions>> { + allow_unstable: bool, +) -> OptPartRes<Option<TestTimeOptions>> { let report_time = unstable_optflag!(matches, allow_unstable, "report-time"); let colored_opt_str = matches.opt_str("report-time"); let mut report_time_colored = report_time && colored_opt_str == Some("colored".into()); @@ -336,7 +328,7 @@ fn get_test_threads(matches: &getopts::Matches) -> OptPartRes<Option<usize>> { fn get_format( matches: &getopts::Matches, quiet: bool, - allow_unstable: bool + allow_unstable: bool, ) -> OptPartRes<OutputFormat> { let format = match matches.opt_str("format").as_ref().map(|s| &**s) { None if quiet => OutputFormat::Terse, @@ -344,9 +336,7 @@ fn get_format( Some("terse") => OutputFormat::Terse, Some("json") => { if !allow_unstable { - return Err( - "The \"json\" format is only accepted on the nightly compiler".into(), - ); + return Err("The \"json\" format is only accepted on the nightly compiler".into()); } OutputFormat::Json } @@ -396,9 +386,7 @@ fn get_nocapture(matches: &getopts::Matches) -> OptPartRes<bool> { fn get_run_ignored(matches: &getopts::Matches, include_ignored: bool) -> OptPartRes<RunIgnored> { let run_ignored = match (include_ignored, matches.opt_present("ignored")) { (true, true) => { - return Err( - "the options --include-ignored and --ignored are mutually exclusive".into(), - ); + return Err("the options --include-ignored and --ignored are mutually exclusive".into()); } (true, false) => RunIgnored::Yes, (false, true) => RunIgnored::Only, @@ -409,11 +397,7 @@ fn get_run_ignored(matches: &getopts::Matches, include_ignored: bool) -> OptPart } fn get_filter(matches: &getopts::Matches) -> OptPartRes<Option<String>> { - let filter = if !matches.free.is_empty() { - Some(matches.free[0].clone()) - } else { - None - }; + let filter = if !matches.free.is_empty() { Some(matches.free[0].clone()) } else { None }; Ok(filter) } @@ -423,9 +407,7 @@ fn get_allow_unstable(matches: &getopts::Matches) -> OptPartRes<bool> { if let Some(opt) = matches.opt_str("Z") { if !is_nightly() { - return Err( - "the option `Z` is only accepted on the nightly compiler".into(), - ); + return Err("the option `Z` is only accepted on the nightly compiler".into()); } match &*opt { |
