diff options
| author | Joshua Nelson <jyn514@gmail.com> | 2020-11-06 17:37:29 -0500 |
|---|---|---|
| committer | Joshua Nelson <jyn514@gmail.com> | 2020-11-14 02:48:13 -0500 |
| commit | c0eedc0b6ad30dfa1eb2b225246b4b3debed1cdb (patch) | |
| tree | 9a7cfc7ed7fbcdf9b03d812c98d922226d6af92a /src/tools/compiletest | |
| parent | 341eb6d6f5c636575a42a5d3d75739755c17aade (diff) | |
| download | rust-c0eedc0b6ad30dfa1eb2b225246b4b3debed1cdb.tar.gz rust-c0eedc0b6ad30dfa1eb2b225246b4b3debed1cdb.zip | |
Address review comments
- remove unused args - Fix formatting - Improve naming - Fix typo
Diffstat (limited to 'src/tools/compiletest')
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 15 | ||||
| -rwxr-xr-x | src/tools/compiletest/tidy-rustdoc.sh | 35 |
2 files changed, 21 insertions, 29 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 819f7257eee..59c650d94cd 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2212,9 +2212,14 @@ impl<'test> TestCx<'test> { proc_res.fatal(None, || ()); } - fn fatal_proc_rec_with_ctx(&self, err: &str, proc_res: &ProcRes, ctx: impl FnOnce(Self)) -> ! { + fn fatal_proc_rec_with_ctx( + &self, + err: &str, + proc_res: &ProcRes, + on_failure: impl FnOnce(Self), + ) -> ! { self.error(err); - proc_res.fatal(None, || ctx(*self)); + proc_res.fatal(None, || on_failure(*self)); } // codegen tests (using FileCheck) @@ -2376,7 +2381,7 @@ impl<'test> TestCx<'test> { .wait() .unwrap(); if !status.success() { - self.fatal("failed to run tidy - is installed?"); + self.fatal("failed to run tidy - is it installed?"); } let status = Command::new(tidy).arg(&compare_dir).spawn().unwrap().wait().unwrap(); if !status.success() { @@ -3653,7 +3658,7 @@ pub struct ProcRes { } impl ProcRes { - pub fn fatal(&self, err: Option<&str>, ctx: impl FnOnce()) -> ! { + pub fn fatal(&self, err: Option<&str>, on_failure: impl FnOnce()) -> ! { if let Some(e) = err { println!("\nerror: {}", e); } @@ -3675,7 +3680,7 @@ impl ProcRes { json::extract_rendered(&self.stdout), json::extract_rendered(&self.stderr), ); - ctx(); + on_failure(); // Use resume_unwind instead of panic!() to prevent a panic message + backtrace from // compiletest, which is unnecessary noise. std::panic::resume_unwind(Box::new(())); diff --git a/src/tools/compiletest/tidy-rustdoc.sh b/src/tools/compiletest/tidy-rustdoc.sh index ce2c99d94d0..b31957058e8 100755 --- a/src/tools/compiletest/tidy-rustdoc.sh +++ b/src/tools/compiletest/tidy-rustdoc.sh @@ -5,30 +5,17 @@ set -euo pipefail indir="${1:?Missing argument 1: input directory}" tidy () { - { - # new-inline-tags is workaround for: - # https://github.com/rust-lang/stdarch/issues/945 - # https://github.com/rust-lang/mdBook/issues/1372 - command tidy \ - --indent yes \ - --indent-spaces 2 \ - --wrap 0 \ - --show-warnings no \ - --markup yes \ - --quiet yes \ - --new-inline-tags 'c t' \ - "$@" \ - >/dev/null \ - || { - # tidy exits with code 1 if there were any warnings :facepalm: - status=$? - if [ $status != 0 ] && [ $status != 1 ] - then - echo "While tidying $1" >&2 - exit 1 - fi - } - } | sed -E 's/#[0-9]+(-[0-9]+)?/#line/g' + command tidy \ + --indent yes \ + --indent-spaces 2 \ + --wrap 0 \ + --show-warnings no \ + --markup yes \ + --quiet yes \ + "$@" \ + >/dev/null \ + # tidy exits with code 1 if there were any warnings + || [ $? -eq 1 ] } find "$indir" -type f -name '*.html' -print0 \ |
