use span_lint_and_note

This commit is contained in:
y21 2023-05-25 20:30:38 +02:00
parent 52c6ef77fd
commit 6b232fdee9

View file

@ -1,6 +1,6 @@
use std::ops::AddAssign; use std::ops::AddAssign;
use clippy_utils::diagnostics::span_lint_and_then; use clippy_utils::diagnostics::span_lint_and_note;
use rustc_hir::def_id::LocalDefId; use rustc_hir::def_id::LocalDefId;
use rustc_hir::intravisit::FnKind; use rustc_hir::intravisit::FnKind;
use rustc_hir::Body; use rustc_hir::Body;
@ -146,14 +146,13 @@ impl<'tcx> LateLintPass<'tcx> for LargeStackFrames {
} }
if frame_size.exceeds_limit(self.maximum_allowed_size) { if frame_size.exceeds_limit(self.maximum_allowed_size) {
span_lint_and_then( span_lint_and_note(
cx, cx,
LARGE_STACK_FRAMES, LARGE_STACK_FRAMES,
span, span,
"this function allocates a large amount of stack space", "this function allocates a large amount of stack space",
|diag| { None,
diag.note("allocating large amounts of stack space can overflow the stack"); "allocating large amounts of stack space can overflow the stack",
},
); );
} }
} }