unused_parens: do not lint against parens around &raw
This commit is contained in:
parent
6a2cd0d50c
commit
c1897960c0
4 changed files with 79 additions and 32 deletions
|
@ -675,6 +675,13 @@ trait UnusedDelimLint {
|
|||
return true;
|
||||
}
|
||||
|
||||
// Do not lint against parentheses around `&raw [const|mut] expr`.
|
||||
// These parentheses will have to be added e.g. when calling a method on the result of this
|
||||
// expression, and we want to avoid churn wrt adding and removing parentheses.
|
||||
if matches!(inner.kind, ast::ExprKind::AddrOf(ast::BorrowKind::Raw, ..)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if LHS needs parens to prevent false-positives in cases like
|
||||
// `fn x() -> u8 { ({ 0 } + 1) }`.
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue