1
Fork 0

Add BorrowKind::Ref

This commit is contained in:
Manish Goregaokar 2019-11-27 14:30:10 -08:00
parent 6eeac46b91
commit 341e266508
26 changed files with 53 additions and 53 deletions

View file

@ -37,7 +37,7 @@ impl EarlyLintPass for DerefAddrOf {
fn check_expr(&mut self, cx: &EarlyContext<'_>, e: &Expr) {
if_chain! {
if let ExprKind::Unary(UnOp::Deref, ref deref_target) = e.kind;
if let ExprKind::AddrOf(_, _, ref addrof_target) = without_parens(deref_target).kind;
if let ExprKind::AddrOf(BorrowKind::Ref, _, ref addrof_target) = without_parens(deref_target).kind;
if !in_macro(addrof_target.span);
then {
let mut applicability = Applicability::MachineApplicable;
@ -80,7 +80,7 @@ impl EarlyLintPass for RefInDeref {
if_chain! {
if let ExprKind::Field(ref object, _) = e.kind;
if let ExprKind::Paren(ref parened) = object.kind;
if let ExprKind::AddrOf(_, _, ref inner) = parened.kind;
if let ExprKind::AddrOf(BorrowKind::Ref, _, ref inner) = parened.kind;
then {
let mut applicability = Applicability::MachineApplicable;
span_lint_and_sugg(