Address review comments
- remove unused args - Fix formatting - Improve naming - Fix typo
This commit is contained in:
parent
341eb6d6f5
commit
c0eedc0b6a
2 changed files with 21 additions and 29 deletions
|
|
@ -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(()));
|
||||
|
|
|
|||
|
|
@ -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 \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue