From 935c53b92eea7c288b781ecd68436c9733ec8a83 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 13 Jun 2021 21:55:51 +0300 Subject: internal: use cov-mark rather than bailing out diagnostic --- crates/hir_ty/src/diagnostics/expr.rs | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'crates/hir_ty/src') diff --git a/crates/hir_ty/src/diagnostics/expr.rs b/crates/hir_ty/src/diagnostics/expr.rs index 2a211fd8e..b809b96a0 100644 --- a/crates/hir_ty/src/diagnostics/expr.rs +++ b/crates/hir_ty/src/diagnostics/expr.rs @@ -50,21 +50,13 @@ pub enum BodyValidationDiagnostic { MissingMatchArms { match_expr: ExprId, }, - InternalBailedOut { - pat: PatId, - }, } impl BodyValidationDiagnostic { - pub fn collect( - db: &dyn HirDatabase, - owner: DefWithBodyId, - internal_diagnostics: bool, - ) -> Vec { + pub fn collect(db: &dyn HirDatabase, owner: DefWithBodyId) -> Vec { let _p = profile::span("BodyValidationDiagnostic::collect"); let infer = db.infer(owner); let mut validator = ExprValidator::new(owner, infer.clone()); - validator.internal_diagnostics = internal_diagnostics; validator.validate_body(db); validator.diagnostics } @@ -74,12 +66,11 @@ struct ExprValidator { owner: DefWithBodyId, infer: Arc, pub(super) diagnostics: Vec, - internal_diagnostics: bool, } impl ExprValidator { fn new(owner: DefWithBodyId, infer: Arc) -> ExprValidator { - ExprValidator { owner, infer, diagnostics: Vec::new(), internal_diagnostics: false } + ExprValidator { owner, infer, diagnostics: Vec::new() } } fn validate_body(&mut self, db: &dyn HirDatabase) { @@ -308,9 +299,7 @@ impl ExprValidator { // fit the match expression, we skip this diagnostic. Skipping the entire // diagnostic rather than just not including this match arm is preferred // to avoid the chance of false positives. - if self.internal_diagnostics { - self.diagnostics.push(BodyValidationDiagnostic::InternalBailedOut { pat: arm.pat }) - } + cov_mark::hit!(validate_match_bailed_out); return; } -- cgit v1.2.3