@@ -4,7 +4,7 @@ use rustc_hir::def::Res;
44use rustc_data_structures:: fx:: FxHashMap ;
55use rustc_hir:: { Block , Expr , ExprKind , PatKind , QPath , Stmt , StmtKind } ;
66use rustc_span:: symbol:: { Ident , Symbol } ;
7- use rustc_middle:: ty:: { Adt , TyS } ;
7+ use rustc_middle:: ty:: { self , Adt , TyS } ;
88
99use rustc_lint:: { LateContext , LateLintPass } ;
1010use rustc_session:: { declare_lint_pass, declare_tool_lint} ;
@@ -123,7 +123,7 @@ impl LateLintPass<'_> for FieldReassignWithDefault {
123123 }
124124}
125125
126- /// Returns the block indices, identifiers and types of bindings set as `Default::default()`.
126+ /// Returns the block indices, identifiers and types of bindings set as `Default::default()`, except for when the pattern type is a tuple .
127127fn enumerate_bindings_using_default < ' cx , ' hir > ( cx : & LateContext < ' cx > , block : & Block < ' hir > ) -> Vec < ( usize , Symbol , & ' cx TyS < ' cx > ) > {
128128 block
129129 . stmts
@@ -145,6 +145,10 @@ fn enumerate_bindings_using_default<'cx, 'hir>(cx: &LateContext<'cx>, block: &Bl
145145 then {
146146 // Get the type of the pattern
147147 let ty = cx. typeck_results( ) . pat_ty( local. pat) ;
148+ // Ignore tuples
149+ if let ty:: Tuple ( _) = ty. kind( ) {
150+ return None ;
151+ }
148152 Some ( ( idx, ident. name, ty) )
149153 }
150154 else {
0 commit comments