X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_lint%2Fsrc%2Funused.rs;h=d829ca43328fe651422bf31ad61ef2e955bbfe9c;hb=beb5cc9cf79b782094bb75fe41df3b7bdbb05bd7;hp=4c9b3df2dbd33d706d04c3cc5e911ceeb9c70a2c;hpb=f55b0022db8dccc6aa6bf3f650b562eaec0fdc54;p=rust.git diff --git a/compiler/rustc_lint/src/unused.rs b/compiler/rustc_lint/src/unused.rs index 4c9b3df2dbd..d829ca43328 100644 --- a/compiler/rustc_lint/src/unused.rs +++ b/compiler/rustc_lint/src/unused.rs @@ -495,6 +495,7 @@ enum UnusedDelimsCtx { ArrayLenExpr, AnonConst, MatchArmExpr, + IndexExpr, } impl From for &'static str { @@ -514,6 +515,7 @@ fn from(ctx: UnusedDelimsCtx) -> &'static str { UnusedDelimsCtx::LetScrutineeExpr => "`let` scrutinee expression", UnusedDelimsCtx::ArrayLenExpr | UnusedDelimsCtx::AnonConst => "const expression", UnusedDelimsCtx::MatchArmExpr => "match arm expression", + UnusedDelimsCtx::IndexExpr => "index expression", } } } @@ -733,6 +735,8 @@ fn check_expr(&mut self, cx: &EarlyContext<'_>, e: &ast::Expr) { (value, UnusedDelimsCtx::ReturnValue, false, Some(left), None) } + Index(_, ref value) => (value, UnusedDelimsCtx::IndexExpr, false, None, None), + Assign(_, ref value, _) | AssignOp(.., ref value) => { (value, UnusedDelimsCtx::AssignedValue, false, None, None) }