mirror of
https://github.com/rust-lang/rust-clippy
synced 2025-02-26 04:17:21 +00:00
use span_lint_and_note
This commit is contained in:
parent
52c6ef77fd
commit
6b232fdee9
1 changed files with 4 additions and 5 deletions
|
@ -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",
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue