Emit warnings on unused parens/braces in index expressions
This commit is contained in:
parent
dc1d9d50fb
commit
c3a71ede7c
3 changed files with 45 additions and 0 deletions
|
@ -495,6 +495,7 @@ enum UnusedDelimsCtx {
|
|||
ArrayLenExpr,
|
||||
AnonConst,
|
||||
MatchArmExpr,
|
||||
IndexExpr,
|
||||
}
|
||||
|
||||
impl From<UnusedDelimsCtx> for &'static str {
|
||||
|
@ -514,6 +515,7 @@ impl From<UnusedDelimsCtx> for &'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 @@ trait UnusedDelimLint {
|
|||
(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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue