]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/default_numeric_fallback.rs
Use TypeckResults::expr_ty instead of TyCtxt::type_of to fix "Not a type" ICE
[rust.git] / clippy_lints / src / default_numeric_fallback.rs
index 6ace9aa6bdfc0d1e06c4bfc1c7906e6b4488a7fc..369efacc9bcf47f87aea5360875ba04f40cae2b4 100644 (file)
@@ -130,10 +130,9 @@ fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {
                 }
             },
 
-            ExprKind::Struct(qpath, fields, base) => {
+            ExprKind::Struct(_, fields, base) => {
                 if_chain! {
-                    if let Some(def_id) = self.cx.qpath_res(qpath, expr.hir_id).opt_def_id();
-                    let ty = self.cx.tcx.type_of(def_id);
+                    let ty = self.cx.typeck_results().expr_ty(expr);
                     if let Some(adt_def) = ty.ty_adt_def();
                     if adt_def.is_struct();
                     if let Some(variant) = adt_def.variants.iter().next();