Inline TypeCtor into Ty
This commit is contained in:
@@ -20,7 +20,7 @@ use hir_def::{
|
||||
use hir_expand::{hygiene::Hygiene, name::AsName, HirFileId, InFile};
|
||||
use hir_ty::{
|
||||
diagnostics::{record_literal_missing_fields, record_pattern_missing_fields},
|
||||
InferenceResult, Substs, Ty,
|
||||
InferenceResult, Substs,
|
||||
};
|
||||
use syntax::{
|
||||
ast::{self, AstNode},
|
||||
@@ -299,14 +299,11 @@ impl SourceAnalyzer {
|
||||
let infer = self.infer.as_ref()?;
|
||||
|
||||
let expr_id = self.expr_id(db, &literal.clone().into())?;
|
||||
let substs = match &infer.type_of_expr[expr_id] {
|
||||
Ty::Apply(a_ty) => &a_ty.parameters,
|
||||
_ => return None,
|
||||
};
|
||||
let substs = infer.type_of_expr[expr_id].substs()?;
|
||||
|
||||
let (variant, missing_fields, _exhaustive) =
|
||||
record_literal_missing_fields(db, infer, expr_id, &body[expr_id])?;
|
||||
let res = self.missing_fields(db, krate, substs, variant, missing_fields);
|
||||
let res = self.missing_fields(db, krate, &substs, variant, missing_fields);
|
||||
Some(res)
|
||||
}
|
||||
|
||||
@@ -320,14 +317,11 @@ impl SourceAnalyzer {
|
||||
let infer = self.infer.as_ref()?;
|
||||
|
||||
let pat_id = self.pat_id(&pattern.clone().into())?;
|
||||
let substs = match &infer.type_of_pat[pat_id] {
|
||||
Ty::Apply(a_ty) => &a_ty.parameters,
|
||||
_ => return None,
|
||||
};
|
||||
let substs = infer.type_of_pat[pat_id].substs()?;
|
||||
|
||||
let (variant, missing_fields, _exhaustive) =
|
||||
record_pattern_missing_fields(db, infer, pat_id, &body[pat_id])?;
|
||||
let res = self.missing_fields(db, krate, substs, variant, missing_fields);
|
||||
let res = self.missing_fields(db, krate, &substs, variant, missing_fields);
|
||||
Some(res)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user