mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-11 09:27:56 +00:00
manual_slice_size_calculation
: Delay constant check.
This commit is contained in:
parent
03117026ae
commit
c0068ba5ac
@ -40,11 +40,11 @@ declare_lint_pass!(ManualSliceSizeCalculation => [MANUAL_SLICE_SIZE_CALCULATION]
|
|||||||
|
|
||||||
impl<'tcx> LateLintPass<'tcx> for ManualSliceSizeCalculation {
|
impl<'tcx> LateLintPass<'tcx> for ManualSliceSizeCalculation {
|
||||||
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) {
|
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) {
|
||||||
// Does not apply inside const because size_of_val is not cost in stable.
|
if let ExprKind::Binary(ref op, left, right) = expr.kind
|
||||||
if !in_constant(cx, expr.hir_id)
|
|
||||||
&& let ExprKind::Binary(ref op, left, right) = expr.kind
|
|
||||||
&& BinOpKind::Mul == op.node
|
&& BinOpKind::Mul == op.node
|
||||||
&& !expr.span.from_expansion()
|
&& !expr.span.from_expansion()
|
||||||
|
// Does not apply inside const because size_of_val is not cost in stable.
|
||||||
|
&& !in_constant(cx, expr.hir_id)
|
||||||
&& let Some(receiver) = simplify(cx, left, right)
|
&& let Some(receiver) = simplify(cx, left, right)
|
||||||
{
|
{
|
||||||
let ctxt = expr.span.ctxt();
|
let ctxt = expr.span.ctxt();
|
||||||
|
Loading…
Reference in New Issue
Block a user