diff --git a/src/compiletest/errors.rs b/src/compiletest/errors.rs index 44634e4d565f..264e32f1d06c 100644 --- a/src/compiletest/errors.rs +++ b/src/compiletest/errors.rs @@ -93,9 +93,8 @@ fn parse_expected(last_nonfollow_error: Option, let (which, line) = if follow { assert!(adjusts == 0, "use either //~| or //~^, not both."); - let line = last_nonfollow_error.unwrap_or_else(|| { - panic!("encountered //~| without preceding //~^ line.") - }); + let line = last_nonfollow_error.expect("encountered //~| without \ + preceding //~^ line."); (FollowPrevious(line), line) } else { let which =