Skip to content

Commit 3e90fa8

Browse files
committed
Only check bindings with explicit type annotations
1 parent bec8a48 commit 3e90fa8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

clippy_lints/src/casts/needless_type_cast.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ fn collect_binding_from_let<'a>(
7171
let_expr: &rustc_hir::LetExpr<'a>,
7272
bindings: &mut FxHashMap<HirId, BindingInfo<'a>>,
7373
) {
74+
if let_expr.ty.is_none() {
75+
return;
76+
}
77+
7478
if let PatKind::Binding(_, hir_id, _, _) = let_expr.pat.kind {
7579
let ty = cx.typeck_results().pat_ty(let_expr.pat);
7680
if ty.is_numeric() {

0 commit comments

Comments
 (0)