Skip to content

Commit dd612a0

Browse files
committed
clippy: LetSource
1 parent ea8dfd3 commit dd612a0

File tree

6 files changed

+10
-9
lines changed

6 files changed

+10
-9
lines changed

Diff for: src/tools/clippy/clippy_lints/src/loops/never_loop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ fn never_loop_expr(expr: &Expr<'_>, main_loop_id: HirId) -> NeverLoopResult {
111111
| ExprKind::Unary(_, e)
112112
| ExprKind::Cast(e, _)
113113
| ExprKind::Type(e, _)
114-
| ExprKind::Let(_, e, _)
114+
| ExprKind::Let(_, e, ..)
115115
| ExprKind::Field(e, _)
116116
| ExprKind::AddrOf(_, _, e)
117117
| ExprKind::Struct(_, _, Some(e))

Diff for: src/tools/clippy/clippy_lints/src/pattern_type_mismatch.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl<'tcx> LateLintPass<'tcx> for PatternTypeMismatch {
117117
}
118118
}
119119
}
120-
if let ExprKind::Let(let_pat, let_expr, _) = expr.kind {
120+
if let ExprKind::Let(let_pat, let_expr, ..) = expr.kind {
121121
if let Some(ref expr_ty) = cx.typeck_results().node_type_opt(let_expr.hir_id) {
122122
if in_external_macro(cx.sess(), let_pat.span) {
123123
return;

Diff for: src/tools/clippy/clippy_lints/src/utils/author.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ impl<'tcx> Visitor<'tcx> for PrintVisitor {
208208
print!(" if let ExprKind::");
209209
let current = format!("{}.kind", self.current);
210210
match expr.kind {
211-
ExprKind::Let(pat, expr, _) => {
211+
ExprKind::Let(pat, expr, ..) => {
212212
let let_pat = self.next("pat");
213213
let let_expr = self.next("expr");
214214
println!(" Let(ref {}, ref {}, _) = {};", let_pat, let_expr, current);

Diff for: src/tools/clippy/clippy_lints/src/utils/inspector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ fn print_expr(cx: &LateContext<'_>, expr: &hir::Expr<'_>, indent: usize) {
142142
print_expr(cx, arg, indent + 1);
143143
}
144144
},
145-
hir::ExprKind::Let(ref pat, ref expr, _) => {
145+
hir::ExprKind::Let(ref pat, ref expr, ..) => {
146146
print_pat(cx, pat, indent + 1);
147147
print_expr(cx, expr, indent + 1);
148148
},

Diff for: src/tools/clippy/clippy_utils/src/higher.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl<'hir> IfLet<'hir> {
9090
pub const fn hir(expr: &Expr<'hir>) -> Option<Self> {
9191
if let ExprKind::If(
9292
Expr {
93-
kind: ExprKind::Let(let_pat, let_expr, _),
93+
kind: ExprKind::Let(let_pat, let_expr, ..),
9494
..
9595
},
9696
if_then,
@@ -329,7 +329,7 @@ impl<'hir> WhileLet<'hir> {
329329
kind:
330330
ExprKind::If(
331331
Expr {
332-
kind: ExprKind::Let(let_pat, let_expr, _),
332+
kind: ExprKind::Let(let_pat, let_expr, ..),
333333
..
334334
},
335335
if_then,

Diff for: src/tools/clippy/clippy_utils/src/hir_utils.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ impl HirEqInterExpr<'_, '_, '_> {
232232
(&ExprKind::If(lc, lt, ref le), &ExprKind::If(rc, rt, ref re)) => {
233233
self.eq_expr(lc, rc) && self.eq_expr(&**lt, &**rt) && both(le, re, |l, r| self.eq_expr(l, r))
234234
},
235-
(&ExprKind::Let(ref lp, ref le, _), &ExprKind::Let(ref rp, ref re, _)) => {
236-
self.eq_pat(lp, rp) && self.eq_expr(le, re)
235+
(&ExprKind::Let(ref lp, ref le, _, ls), &ExprKind::Let(ref rp, ref re, _, rs)) => {
236+
self.eq_pat(lp, rp) && self.eq_expr(le, re) && ls == rs
237237
},
238238
(&ExprKind::Lit(ref l), &ExprKind::Lit(ref r)) => l.node == r.node,
239239
(&ExprKind::Loop(lb, ref ll, ref lls, _), &ExprKind::Loop(rb, ref rl, ref rls, _)) => {
@@ -668,9 +668,10 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
668668
}
669669
}
670670
},
671-
ExprKind::Let(ref pat, ref expr, _) => {
671+
ExprKind::Let(ref pat, ref expr, _, source) => {
672672
self.hash_expr(expr);
673673
self.hash_pat(pat);
674+
std::mem::discriminant(&source).hash(&mut self.s);
674675
},
675676
ExprKind::LlvmInlineAsm(..) | ExprKind::Err => {},
676677
ExprKind::Lit(ref l) => {

0 commit comments

Comments
 (0)