Skip to content

Commit 9cb7a54

Browse files
committed
lint test_without_fail_case itself
1 parent e0fc5b4 commit 9cb7a54

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

clippy_lints/src/test_without_fail_case.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use clippy_utils::diagnostics::span_lint_and_then;
1+
use clippy_utils::diagnostics::span_lint_and_note;
22
use clippy_utils::macros::{is_panic, root_macro_call_first_node};
33
use clippy_utils::ty::is_type_diagnostic_item;
44
use clippy_utils::visitors::Visitable;
@@ -62,14 +62,13 @@ impl<'tcx> LateLintPass<'tcx> for TestWithoutFailCase {
6262
let panic_span = SearchPanicIntraFunction::find_span(cx, typeck_results, body);
6363
if panic_span.is_none() {
6464
// No way to panic for this test function
65-
span_lint_and_then(
65+
span_lint_and_note(
6666
cx,
6767
TEST_WITHOUT_FAIL_CASE,
6868
item.span,
6969
"this function marked with `#[test]` cannot fail and will always succeed",
70-
|diag| {
71-
diag.note("consider adding assertions or panics to test failure cases");
72-
},
70+
None,
71+
"consider adding assertions or panics to test failure cases",
7372
);
7473
}
7574
}
@@ -146,7 +145,7 @@ impl<'a, 'tcx> SearchPanicIntraFunction<'a, 'tcx> {
146145
}
147146
}
148147

149-
impl<'a, 'tcx> Visitor<'tcx> for SearchPanicIntraFunction<'a, 'tcx> {
148+
impl<'tcx> Visitor<'tcx> for SearchPanicIntraFunction<'_, 'tcx> {
150149
type NestedFilter = nested_filter::OnlyBodies;
151150

152151
fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {

0 commit comments

Comments
 (0)