Skip to content

Commit d36696e

Browse files
committed
Cleanup formatting, make error messages match
1 parent 1d2c554 commit d36696e

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/libsyntax/test.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ enum BadTestSignature {
328328
NotEvenAFunction,
329329
WrongTypeSignature,
330330
NoArgumentsAllowed,
331-
ShouldPanicOnlyWithNoArgs
331+
ShouldPanicOnlyWithNoArgs,
332332
}
333333

334334
fn is_test_fn(cx: &TestCtxt, i: &ast::Item) -> bool {
@@ -347,7 +347,7 @@ fn is_test_fn(cx: &TestCtxt, i: &ast::Item) -> bool {
347347
};
348348

349349
if !decl.inputs.is_empty() {
350-
return No(BadTestSignature::NoArgumentsAllowed)
350+
return No(BadTestSignature::NoArgumentsAllowed);
351351
}
352352

353353
match (has_output, cx.features.termination_trait_test, has_should_panic_attr) {
@@ -359,7 +359,6 @@ fn is_test_fn(cx: &TestCtxt, i: &ast::Item) -> bool {
359359
},
360360
(true, false, _) => No(BadTestSignature::WrongTypeSignature),
361361
(false, _, _) => Yes
362-
363362
}
364363
}
365364
_ => No(BadTestSignature::NotEvenAFunction),
@@ -375,11 +374,14 @@ fn is_test_fn(cx: &TestCtxt, i: &ast::Item) -> bool {
375374
BadTestSignature::NotEvenAFunction =>
376375
diag.span_err(i.span, "only functions may be used as tests"),
377376
BadTestSignature::WrongTypeSignature =>
378-
diag.span_err(i.span, "functions used as tests must have signature fn() -> ()"),
377+
diag.span_err(i.span,
378+
"functions used as tests must have signature fn() -> ()"),
379379
BadTestSignature::NoArgumentsAllowed =>
380380
diag.span_err(i.span, "functions used as tests can not have any arguments"),
381381
BadTestSignature::ShouldPanicOnlyWithNoArgs =>
382-
diag.span_err(i.span, "test functions returning Result<> must not use #[should_panic]"),
382+
diag.span_err(i.span,
383+
"functions used as tests returning Result<_, _> must \
384+
not use #[should_panic]"),
383385
}
384386
false
385387
}
@@ -420,7 +422,7 @@ fn is_bench_fn(cx: &TestCtxt, i: &ast::Item) -> bool {
420422
// well before resolve, can't get too deep.
421423
input_cnt == 1 && output_matches
422424
}
423-
_ => false
425+
_ => false
424426
}
425427
}
426428

src/test/run-pass/rfc-1937-termination-trait/termination-trait-in-test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fn is_a_num() -> Result<(), ParseIntError> {
2626
#[test]
2727
#[should_panic]
2828
fn not_a_num() -> Result<(), ParseIntError> {
29-
//~^ ERROR Tests returning Result cannot use #[should_panic] https://github.com/rust-lang/rust/issues/48854
29+
//~^ ERROR test functions returning Result<_, _> must not use #[should_panic]
3030
let _: u32 = "abc".parse()?;
3131
Ok(())
3232
}

0 commit comments

Comments
 (0)