match scrutinee need necessary parentheses for structs
This commit is contained in:
parent
3071e0aef6
commit
c44b35e1c3
3 changed files with 68 additions and 0 deletions
|
@ -666,6 +666,24 @@ trait UnusedDelimLint {
|
|||
if !followed_by_block {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if we need parens for `match &( Struct { feild: }) {}`.
|
||||
{
|
||||
let mut innermost = inner;
|
||||
loop {
|
||||
innermost = match &innermost.kind {
|
||||
ExprKind::AddrOf(_, _, expr) => expr,
|
||||
_ => {
|
||||
if parser::contains_exterior_struct_lit(&innermost) {
|
||||
return true;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let mut innermost = inner;
|
||||
loop {
|
||||
innermost = match &innermost.kind {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue