diff options
| author | Yoshitomo Nakanishi <yurayura.rounin.3@gmail.com> | 2021-02-27 21:52:15 +0900 |
|---|---|---|
| committer | Yoshitomo Nakanishi <yurayura.rounin.3@gmail.com> | 2021-02-27 22:57:29 +0900 |
| commit | bdeec5dbd6e484cec26039cb795193ab044cf4d9 (patch) | |
| tree | 70bea6f06c2025cddafe38255b820c162055e27c /clippy_lints/src/default_numeric_fallback.rs | |
| parent | 7154b2360114977cd67bb844114cf429fa9cdb88 (diff) | |
| download | rust-bdeec5dbd6e484cec26039cb795193ab044cf4d9.tar.gz rust-bdeec5dbd6e484cec26039cb795193ab044cf4d9.zip | |
Use TypeckResults::expr_ty instead of TyCtxt::type_of to fix "Not a type" ICE
Diffstat (limited to 'clippy_lints/src/default_numeric_fallback.rs')
| -rw-r--r-- | clippy_lints/src/default_numeric_fallback.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/clippy_lints/src/default_numeric_fallback.rs b/clippy_lints/src/default_numeric_fallback.rs index 6ace9aa6bdf..369efacc9bc 100644 --- a/clippy_lints/src/default_numeric_fallback.rs +++ b/clippy_lints/src/default_numeric_fallback.rs @@ -130,10 +130,9 @@ impl<'a, 'tcx> Visitor<'tcx> for NumericFallbackVisitor<'a, 'tcx> { } }, - 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(); |
