X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_lint%2Fsrc%2Funused.rs;h=d829ca43328fe651422bf31ad61ef2e955bbfe9c;hb=d9db35785d33e2b6c6e9b4971dfdbe0984a69b9e;hp=4c9b3df2dbd33d706d04c3cc5e911ceeb9c70a2c;hpb=487e83b711b96d84ce2edfc4cb4ba792c10b589e;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) }