Skip to content

Commit 341e266

Browse files
committed
Add BorrowKind::Ref
1 parent 6eeac46 commit 341e266

26 files changed

+53
-53
lines changed

clippy_lints/src/bytecount.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ fn check_arg(name: Name, arg: Name, needle: &Expr) -> bool {
101101

102102
fn get_path_name(expr: &Expr) -> Option<Name> {
103103
match expr.kind {
104-
ExprKind::Box(ref e) | ExprKind::AddrOf(_, _, ref e) | ExprKind::Unary(UnOp::UnDeref, ref e) => {
104+
ExprKind::Box(ref e) | ExprKind::AddrOf(BorrowKind::Ref, _, ref e) | ExprKind::Unary(UnOp::UnDeref, ref e) => {
105105
get_path_name(e)
106106
},
107107
ExprKind::Block(ref b, _) => {

clippy_lints/src/entry.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ fn check_cond<'a, 'tcx, 'b>(
105105
if let ExprKind::MethodCall(ref path, _, ref params) = check.kind;
106106
if params.len() >= 2;
107107
if path.ident.name == sym!(contains_key);
108-
if let ExprKind::AddrOf(_, _, ref key) = params[1].kind;
108+
if let ExprKind::AddrOf(BorrowKind::Ref, _, ref key) = params[1].kind;
109109
then {
110110
let map = &params[0];
111111
let obj_ty = walk_ptrs_ty(cx.tables.expr_ty(map));

clippy_lints/src/eq_op.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
8686
// do not suggest to dereference literals
8787
(&ExprKind::Lit(..), _) | (_, &ExprKind::Lit(..)) => {},
8888
// &foo == &bar
89-
(&ExprKind::AddrOf(_, _, ref l), &ExprKind::AddrOf(_, _, ref r)) => {
89+
(&ExprKind::AddrOf(BorrowKind::Ref, _, ref l), &ExprKind::AddrOf(BorrowKind::Ref, _, ref r)) => {
9090
let lty = cx.tables.expr_ty(l);
9191
let rty = cx.tables.expr_ty(r);
9292
let lcpy = is_copy(cx, lty);
@@ -143,7 +143,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
143143
}
144144
},
145145
// &foo == bar
146-
(&ExprKind::AddrOf(_, _, ref l), _) => {
146+
(&ExprKind::AddrOf(BorrowKind::Ref, _, ref l), _) => {
147147
let lty = cx.tables.expr_ty(l);
148148
let lcpy = is_copy(cx, lty);
149149
if (requires_ref || lcpy)
@@ -161,7 +161,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
161161
}
162162
},
163163
// foo == &bar
164-
(_, &ExprKind::AddrOf(_, _, ref r)) => {
164+
(_, &ExprKind::AddrOf(BorrowKind::Ref, _, ref r)) => {
165165
let rty = cx.tables.expr_ty(r);
166166
let rcpy = is_copy(cx, rty);
167167
if (requires_ref || rcpy)

clippy_lints/src/eval_order_dependence.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ReadVisitor<'a, 'tcx> {
328328
// ```
329329
//
330330
// TODO: fix this
331-
ExprKind::AddrOf(_, _, _) => {
331+
ExprKind::AddrOf(BorrowKind::Ref, _, _) => {
332332
return;
333333
}
334334
_ => {}

clippy_lints/src/explicit_write.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ fn write_output_string(write_args: &HirVec<Expr>) -> Option<String> {
135135
if write_args.len() > 1;
136136
if let ExprKind::Call(_, ref output_args) = write_args[1].kind;
137137
if output_args.len() > 0;
138-
if let ExprKind::AddrOf(_, _, ref output_string_expr) = output_args[0].kind;
138+
if let ExprKind::AddrOf(BorrowKind::Ref, _, ref output_string_expr) = output_args[0].kind;
139139
if let ExprKind::Array(ref string_exprs) = output_string_expr.kind;
140140
// we only want to provide an automatic suggestion for simple (non-format) strings
141141
if string_exprs.len() == 1;

clippy_lints/src/format.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ fn span_useless_format<T: LintContext>(cx: &T, span: Span, help: &str, mut sugg:
7373

7474
fn on_argumentv1_new<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr, arms: &'tcx [Arm]) -> Option<String> {
7575
if_chain! {
76-
if let ExprKind::AddrOf(_, _, ref format_args) = expr.kind;
76+
if let ExprKind::AddrOf(BorrowKind::Ref, _, ref format_args) = expr.kind;
7777
if let ExprKind::Array(ref elems) = arms[0].body.kind;
7878
if elems.len() == 1;
7979
if let Some(args) = match_function_call(cx, &elems[0], &paths::FMT_ARGUMENTV1_NEW);
@@ -115,13 +115,13 @@ fn on_new_v1<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) -> Option<S
115115
if let Some(args) = match_function_call(cx, expr, &paths::FMT_ARGUMENTS_NEW_V1);
116116
if args.len() == 2;
117117
// Argument 1 in `new_v1()`
118-
if let ExprKind::AddrOf(_, _, ref arr) = args[0].kind;
118+
if let ExprKind::AddrOf(BorrowKind::Ref, _, ref arr) = args[0].kind;
119119
if let ExprKind::Array(ref pieces) = arr.kind;
120120
if pieces.len() == 1;
121121
if let ExprKind::Lit(ref lit) = pieces[0].kind;
122122
if let LitKind::Str(ref s, _) = lit.node;
123123
// Argument 2 in `new_v1()`
124-
if let ExprKind::AddrOf(_, _, ref arg1) = args[1].kind;
124+
if let ExprKind::AddrOf(BorrowKind::Ref, _, ref arg1) = args[1].kind;
125125
if let ExprKind::Match(ref matchee, ref arms, MatchSource::Normal) = arg1.kind;
126126
if arms.len() == 1;
127127
if let ExprKind::Tup(ref tup) = matchee.kind;
@@ -143,13 +143,13 @@ fn on_new_v1_fmt<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) -> Opti
143143
if args.len() == 3;
144144
if check_unformatted(&args[2]);
145145
// Argument 1 in `new_v1_formatted()`
146-
if let ExprKind::AddrOf(_, _, ref arr) = args[0].kind;
146+
if let ExprKind::AddrOf(BorrowKind::Ref, _, ref arr) = args[0].kind;
147147
if let ExprKind::Array(ref pieces) = arr.kind;
148148
if pieces.len() == 1;
149149
if let ExprKind::Lit(ref lit) = pieces[0].kind;
150150
if let LitKind::Str(..) = lit.node;
151151
// Argument 2 in `new_v1_formatted()`
152-
if let ExprKind::AddrOf(_, _, ref arg1) = args[1].kind;
152+
if let ExprKind::AddrOf(BorrowKind::Ref, _, ref arg1) = args[1].kind;
153153
if let ExprKind::Match(ref matchee, ref arms, MatchSource::Normal) = arg1.kind;
154154
if arms.len() == 1;
155155
if let ExprKind::Tup(ref tup) = matchee.kind;
@@ -173,7 +173,7 @@ fn on_new_v1_fmt<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) -> Opti
173173
/// ```
174174
fn check_unformatted(expr: &Expr) -> bool {
175175
if_chain! {
176-
if let ExprKind::AddrOf(_, _, ref expr) = expr.kind;
176+
if let ExprKind::AddrOf(BorrowKind::Ref, _, ref expr) = expr.kind;
177177
if let ExprKind::Array(ref exprs) = expr.kind;
178178
if exprs.len() == 1;
179179
// struct `core::fmt::rt::v1::Argument`

clippy_lints/src/functions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ impl<'a, 'tcx> intravisit::Visitor<'tcx> for StaticMutVisitor<'a, 'tcx> {
656656
tys.clear();
657657
}
658658
},
659-
Assign(ref target, _) | AssignOp(_, ref target, _) | AddrOf(_, hir::Mutability::Mutable, ref target) => {
659+
Assign(ref target, _) | AssignOp(_, ref target, _) | AddrOf(BorrowKind::Ref, hir::Mutability::Mutable, ref target) => {
660660
self.mutates_static |= is_mutated_static(self.cx, target)
661661
},
662662
_ => {},

clippy_lints/src/infinite_iter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ fn is_infinite(cx: &LateContext<'_, '_>, expr: &Expr) -> Finiteness {
163163
Finite
164164
},
165165
ExprKind::Block(ref block, _) => block.expr.as_ref().map_or(Finite, |e| is_infinite(cx, e)),
166-
ExprKind::Box(ref e) | ExprKind::AddrOf(_, _, ref e) => is_infinite(cx, e),
166+
ExprKind::Box(ref e) | ExprKind::AddrOf(BorrowKind::Ref, _, ref e) => is_infinite(cx, e),
167167
ExprKind::Call(ref path, _) => {
168168
if let ExprKind::Path(ref qpath) = path.kind {
169169
match_qpath(qpath, &paths::REPEAT).into()

clippy_lints/src/loops.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ fn never_loop_expr(expr: &Expr, main_loop_id: HirId) -> NeverLoopResult {
674674
| ExprKind::Cast(ref e, _)
675675
| ExprKind::Type(ref e, _)
676676
| ExprKind::Field(ref e, _)
677-
| ExprKind::AddrOf(_, _, ref e)
677+
| ExprKind::AddrOf(BorrowKind::Ref, _, ref e)
678678
| ExprKind::Struct(_, _, Some(ref e))
679679
| ExprKind::Repeat(ref e, _)
680680
| ExprKind::DropTemps(ref e) => never_loop_expr(e, main_loop_id),
@@ -1504,7 +1504,7 @@ fn make_iterator_snippet(cx: &LateContext<'_, '_>, arg: &Expr, applic_ref: &mut
15041504
// (&x).into_iter() ==> x.iter()
15051505
// (&mut x).into_iter() ==> x.iter_mut()
15061506
match &arg.kind {
1507-
ExprKind::AddrOf(_, mutability, arg_inner)
1507+
ExprKind::AddrOf(BorrowKind::Ref, mutability, arg_inner)
15081508
if has_iter_method(cx, cx.tables.expr_ty(&arg_inner)).is_some() =>
15091509
{
15101510
let meth_name = match mutability {
@@ -1551,7 +1551,7 @@ fn check_for_loop_over_map_kv<'a, 'tcx>(
15511551
Mutability::Mutable => "_mut",
15521552
};
15531553
let arg = match arg.kind {
1554-
ExprKind::AddrOf(_, _, ref expr) => &**expr,
1554+
ExprKind::AddrOf(BorrowKind::Ref, _, ref expr) => &**expr,
15551555
_ => arg,
15561556
};
15571557

@@ -1875,7 +1875,7 @@ impl<'a, 'tcx> Visitor<'tcx> for VarVisitor<'a, 'tcx> {
18751875
self.prefer_mutable = false;
18761876
self.visit_expr(rhs);
18771877
},
1878-
ExprKind::AddrOf(_, mutbl, ref expr) => {
1878+
ExprKind::AddrOf(BorrowKind::Ref, mutbl, ref expr) => {
18791879
if mutbl == Mutability::Mutable {
18801880
self.prefer_mutable = true;
18811881
}
@@ -2092,7 +2092,7 @@ impl<'a, 'tcx> Visitor<'tcx> for IncrementVisitor<'a, 'tcx> {
20922092
}
20932093
},
20942094
ExprKind::Assign(ref lhs, _) if lhs.hir_id == expr.hir_id => *state = VarState::DontWarn,
2095-
ExprKind::AddrOf(_, mutability, _) if mutability == Mutability::Mutable => {
2095+
ExprKind::AddrOf(BorrowKind::Ref, mutability, _) if mutability == Mutability::Mutable => {
20962096
*state = VarState::DontWarn
20972097
},
20982098
_ => (),
@@ -2176,7 +2176,7 @@ impl<'a, 'tcx> Visitor<'tcx> for InitializeVisitor<'a, 'tcx> {
21762176
VarState::DontWarn
21772177
}
21782178
},
2179-
ExprKind::AddrOf(_, mutability, _) if mutability == Mutability::Mutable => {
2179+
ExprKind::AddrOf(BorrowKind::Ref, mutability, _) if mutability == Mutability::Mutable => {
21802180
self.state = VarState::DontWarn
21812181
},
21822182
_ => (),

clippy_lints/src/matches.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ fn is_panic_block(block: &Block) -> bool {
570570
fn check_match_ref_pats(cx: &LateContext<'_, '_>, ex: &Expr, arms: &[Arm], expr: &Expr) {
571571
if has_only_ref_pats(arms) {
572572
let mut suggs = Vec::new();
573-
let (title, msg) = if let ExprKind::AddrOf(_, Mutability::Immutable, ref inner) = ex.kind {
573+
let (title, msg) = if let ExprKind::AddrOf(BorrowKind::Ref, Mutability::Immutable, ref inner) = ex.kind {
574574
let span = ex.span.source_callsite();
575575
suggs.push((span, Sugg::hir_with_macro_callsite(cx, inner, "..").to_string()));
576576
(

clippy_lints/src/mem_discriminant.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::utils::{match_def_path, paths, snippet, span_lint_and_then, walk_ptrs_ty_depth};
22
use if_chain::if_chain;
3-
use rustc::hir::{Expr, ExprKind};
3+
use rustc::hir::{BorrowKind, Expr, ExprKind};
44
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
55
use rustc::{declare_lint_pass, declare_tool_lint};
66
use rustc_errors::Applicability;
@@ -57,7 +57,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MemDiscriminant {
5757
let mut derefs_needed = ptr_depth;
5858
let mut cur_expr = param;
5959
while derefs_needed > 0 {
60-
if let ExprKind::AddrOf(_, _, ref inner_expr) = cur_expr.kind {
60+
if let ExprKind::AddrOf(BorrowKind::Ref, _, ref inner_expr) = cur_expr.kind {
6161
derefs_needed -= 1;
6262
cur_expr = inner_expr;
6363
} else {

clippy_lints/src/mem_replace.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::utils::{
22
match_def_path, match_qpath, paths, snippet_with_applicability, span_help_and_lint, span_lint_and_sugg,
33
};
44
use if_chain::if_chain;
5-
use rustc::hir::{Expr, ExprKind, Mutability, QPath};
5+
use rustc::hir::{BorrowKind, Expr, ExprKind, Mutability, QPath};
66
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
77
use rustc::{declare_lint_pass, declare_tool_lint};
88
use rustc_errors::Applicability;
@@ -90,7 +90,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MemReplace {
9090
// argument's type. All that's left is to get
9191
// replacee's path.
9292
let replaced_path = match func_args[0].kind {
93-
ExprKind::AddrOf(_, Mutability::Mutable, ref replaced) => {
93+
ExprKind::AddrOf(BorrowKind::Ref, Mutability::Mutable, ref replaced) => {
9494
if let ExprKind::Path(QPath::Resolved(None, ref replaced_path)) = replaced.kind {
9595
replaced_path
9696
} else {

clippy_lints/src/methods/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1519,7 +1519,7 @@ fn lint_expect_fun_call(cx: &LateContext<'_, '_>, expr: &hir::Expr, method_span:
15191519
let mut arg_root = arg;
15201520
loop {
15211521
arg_root = match &arg_root.kind {
1522-
hir::ExprKind::AddrOf(_, _, expr) => expr,
1522+
hir::ExprKind::AddrOf(hir::BorrowKind::Ref, _, expr) => expr,
15231523
hir::ExprKind::MethodCall(method_name, _, call_args) => {
15241524
if call_args.len() == 1
15251525
&& (method_name.ident.name == sym!(as_str) || method_name.ident.name == sym!(as_ref))
@@ -1561,7 +1561,7 @@ fn lint_expect_fun_call(cx: &LateContext<'_, '_>, expr: &hir::Expr, method_span:
15611561
applicability: &mut Applicability,
15621562
) -> Vec<String> {
15631563
if_chain! {
1564-
if let hir::ExprKind::AddrOf(_, _, ref format_arg) = a.kind;
1564+
if let hir::ExprKind::AddrOf(hir::BorrowKind::Ref, _, ref format_arg) = a.kind;
15651565
if let hir::ExprKind::Match(ref format_arg_expr, _, _) = format_arg.kind;
15661566
if let hir::ExprKind::Tup(ref format_arg_expr_tup) = format_arg_expr.kind;
15671567

@@ -1578,7 +1578,7 @@ fn lint_expect_fun_call(cx: &LateContext<'_, '_>, expr: &hir::Expr, method_span:
15781578

15791579
fn is_call(node: &hir::ExprKind) -> bool {
15801580
match node {
1581-
hir::ExprKind::AddrOf(_, _, expr) => {
1581+
hir::ExprKind::AddrOf(hir::BorrowKind::Ref, _, expr) => {
15821582
is_call(&expr.kind)
15831583
},
15841584
hir::ExprKind::Call(..)

clippy_lints/src/mut_mut.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ impl<'a, 'tcx> intravisit::Visitor<'tcx> for MutVisitor<'a, 'tcx> {
5757
// Let's ignore the generated code.
5858
intravisit::walk_expr(self, arg);
5959
intravisit::walk_expr(self, body);
60-
} else if let hir::ExprKind::AddrOf(_, hir::Mutability::Mutable, ref e) = expr.kind {
61-
if let hir::ExprKind::AddrOf(_, hir::Mutability::Mutable, _) = e.kind {
60+
} else if let hir::ExprKind::AddrOf(hir::BorrowKind::Ref, hir::Mutability::Mutable, ref e) = expr.kind {
61+
if let hir::ExprKind::AddrOf(hir::BorrowKind::Ref, hir::Mutability::Mutable, _) = e.kind {
6262
span_lint(
6363
self.cx,
6464
MUT_MUT,

clippy_lints/src/mut_reference.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ fn check_arguments<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, arguments: &[Expr], typ
6060
mutbl: Mutability::Immutable,
6161
..
6262
}) => {
63-
if let ExprKind::AddrOf(_, Mutability::Mutable, _) = argument.kind {
63+
if let ExprKind::AddrOf(BorrowKind::Ref, Mutability::Mutable, _) = argument.kind {
6464
span_lint(
6565
cx,
6666
UNNECESSARY_MUT_PASSED,

clippy_lints/src/mutable_debug_assertion.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::utils::{is_direct_expn_of, span_lint};
22
use if_chain::if_chain;
33
use matches::matches;
44
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
5-
use rustc::hir::{Expr, ExprKind, Mutability, StmtKind, UnOp};
5+
use rustc::hir::{BorrowKind, Expr, ExprKind, Mutability, StmtKind, UnOp};
66
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
77
use rustc::{declare_lint_pass, declare_tool_lint, ty};
88
use syntax_pos::Span;
@@ -77,14 +77,14 @@ fn extract_call<'a, 'tcx>(cx: &'a LateContext<'a, 'tcx>, e: &'tcx Expr) -> Optio
7777
if let ExprKind::Tup(ref conditions) = headerexpr.kind;
7878
if conditions.len() == 2;
7979
then {
80-
if let ExprKind::AddrOf(_, _, ref lhs) = conditions[0].kind {
80+
if let ExprKind::AddrOf(BorrowKind::Ref, _, ref lhs) = conditions[0].kind {
8181
let mut visitor = MutArgVisitor::new(cx);
8282
visitor.visit_expr(lhs);
8383
if let Some(span) = visitor.expr_span() {
8484
return Some(span);
8585
}
8686
}
87-
if let ExprKind::AddrOf(_, _, ref rhs) = conditions[1].kind {
87+
if let ExprKind::AddrOf(BorrowKind::Ref, _, ref rhs) = conditions[1].kind {
8888
let mut visitor = MutArgVisitor::new(cx);
8989
visitor.visit_expr(rhs);
9090
if let Some(span) = visitor.expr_span() {
@@ -128,7 +128,7 @@ impl<'a, 'tcx> MutArgVisitor<'a, 'tcx> {
128128
impl<'a, 'tcx> Visitor<'tcx> for MutArgVisitor<'a, 'tcx> {
129129
fn visit_expr(&mut self, expr: &'tcx Expr) {
130130
match expr.kind {
131-
ExprKind::AddrOf(_, Mutability::Mutable, _) => {
131+
ExprKind::AddrOf(BorrowKind::Ref, Mutability::Mutable, _) => {
132132
self.found = true;
133133
return;
134134
},

clippy_lints/src/needless_borrow.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
use crate::utils::{snippet_opt, span_lint_and_then};
66
use if_chain::if_chain;
7-
use rustc::hir::{BindingAnnotation, Expr, ExprKind, HirId, Item, Mutability, Pat, PatKind};
7+
use rustc::hir::{BindingAnnotation, BorrowKind, Expr, ExprKind, HirId, Item, Mutability, Pat, PatKind};
88
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
99
use rustc::ty;
1010
use rustc::ty::adjustment::{Adjust, Adjustment};
@@ -41,7 +41,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessBorrow {
4141
if e.span.from_expansion() || self.derived_item.is_some() {
4242
return;
4343
}
44-
if let ExprKind::AddrOf(_, Mutability::Immutable, ref inner) = e.kind {
44+
if let ExprKind::AddrOf(BorrowKind::Ref, Mutability::Immutable, ref inner) = e.kind {
4545
if let ty::Ref(..) = cx.tables.expr_ty(inner).kind {
4646
for adj3 in cx.tables.expr_adjustments(e).windows(3) {
4747
if let [Adjustment {

clippy_lints/src/no_effect.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ fn has_no_effect(cx: &LateContext<'_, '_>, expr: &Expr) -> bool {
5858
| ExprKind::Type(ref inner, _)
5959
| ExprKind::Unary(_, ref inner)
6060
| ExprKind::Field(ref inner, _)
61-
| ExprKind::AddrOf(_, _, ref inner)
61+
| ExprKind::AddrOf(BorrowKind::Ref, _, ref inner)
6262
| ExprKind::Box(ref inner) => has_no_effect(cx, inner),
6363
ExprKind::Struct(_, ref fields, ref base) => {
6464
!has_drop(cx, cx.tables.expr_ty(expr))
@@ -134,7 +134,7 @@ fn reduce_expression<'a>(cx: &LateContext<'_, '_>, expr: &'a Expr) -> Option<Vec
134134
| ExprKind::Type(ref inner, _)
135135
| ExprKind::Unary(_, ref inner)
136136
| ExprKind::Field(ref inner, _)
137-
| ExprKind::AddrOf(_, _, ref inner)
137+
| ExprKind::AddrOf(BorrowKind::Ref, _, ref inner)
138138
| ExprKind::Box(ref inner) => reduce_expression(cx, inner).or_else(|| Some(vec![inner])),
139139
ExprKind::Struct(_, ref fields, ref base) => {
140140
if has_drop(cx, cx.tables.expr_ty(expr)) {

0 commit comments

Comments
 (0)