Skip to content

Commit d43c424

Browse files
committed
1 parent cc35165 commit d43c424

26 files changed

+48
-48
lines changed

clippy_lints/src/bytecount.rs

Lines changed: 1 addition & 1 deletion
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) => get_path_name(e),
104+
ExprKind::Box(ref e) | ExprKind::AddrOf(_, _, ref e) | ExprKind::Unary(UnOp::UnDeref, ref e) => get_path_name(e),
105105
ExprKind::Block(ref b, _) => {
106106
if b.stmts.is_empty() {
107107
b.expr.as_ref().and_then(|p| get_path_name(p))

clippy_lints/src/entry.rs

Lines changed: 1 addition & 1 deletion
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(_, _, 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

Lines changed: 3 additions & 3 deletions
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(_, _, ref l), &ExprKind::AddrOf(_, _, 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(_, _, 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(_, _, 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

Lines changed: 1 addition & 1 deletion
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(_, _, _) => {
332332
return;
333333
}
334334
_ => {}

clippy_lints/src/explicit_write.rs

Lines changed: 1 addition & 1 deletion
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(_, _, 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

Lines changed: 6 additions & 6 deletions
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(_, _, 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(_, _, 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(_, _, 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(_, _, 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(_, _, 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(_, _, 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

Lines changed: 1 addition & 1 deletion
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(_, hir::Mutability::Mutable, ref target) => {
660660
self.mutates_static |= is_mutated_static(self.cx, target)
661661
},
662662
_ => {},

clippy_lints/src/infinite_iter.rs

Lines changed: 1 addition & 1 deletion
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(_, _, 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

Lines changed: 6 additions & 6 deletions
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(_, _, 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) if has_iter_method(cx, cx.tables.expr_ty(&arg_inner)).is_some() => {
1507+
ExprKind::AddrOf(_, mutability, arg_inner) if has_iter_method(cx, cx.tables.expr_ty(&arg_inner)).is_some() => {
15081508
let meth_name = match mutability {
15091509
Mutability::Mutable => "iter_mut",
15101510
Mutability::Immutable => "iter",
@@ -1549,7 +1549,7 @@ fn check_for_loop_over_map_kv<'a, 'tcx>(
15491549
Mutability::Mutable => "_mut",
15501550
};
15511551
let arg = match arg.kind {
1552-
ExprKind::AddrOf(_, ref expr) => &**expr,
1552+
ExprKind::AddrOf(_, _, ref expr) => &**expr,
15531553
_ => arg,
15541554
};
15551555

@@ -1873,7 +1873,7 @@ impl<'a, 'tcx> Visitor<'tcx> for VarVisitor<'a, 'tcx> {
18731873
self.prefer_mutable = false;
18741874
self.visit_expr(rhs);
18751875
},
1876-
ExprKind::AddrOf(mutbl, ref expr) => {
1876+
ExprKind::AddrOf(_, mutbl, ref expr) => {
18771877
if mutbl == Mutability::Mutable {
18781878
self.prefer_mutable = true;
18791879
}
@@ -2090,7 +2090,7 @@ impl<'a, 'tcx> Visitor<'tcx> for IncrementVisitor<'a, 'tcx> {
20902090
}
20912091
},
20922092
ExprKind::Assign(ref lhs, _) if lhs.hir_id == expr.hir_id => *state = VarState::DontWarn,
2093-
ExprKind::AddrOf(mutability, _) if mutability == Mutability::Mutable => *state = VarState::DontWarn,
2093+
ExprKind::AddrOf(_, mutability, _) if mutability == Mutability::Mutable => *state = VarState::DontWarn,
20942094
_ => (),
20952095
}
20962096
}
@@ -2172,7 +2172,7 @@ impl<'a, 'tcx> Visitor<'tcx> for InitializeVisitor<'a, 'tcx> {
21722172
VarState::DontWarn
21732173
}
21742174
},
2175-
ExprKind::AddrOf(mutability, _) if mutability == Mutability::Mutable => {
2175+
ExprKind::AddrOf(_, mutability, _) if mutability == Mutability::Mutable => {
21762176
self.state = VarState::DontWarn
21772177
},
21782178
_ => (),

clippy_lints/src/matches.rs

Lines changed: 1 addition & 1 deletion
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(_, 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
(

0 commit comments

Comments
 (0)