Unnamed repository; edit this file 'description' to name the repository.
Add coverage mark for struct init shorthand test
nathan.whitaker 2021-08-31
parent e4757f9 · commit e1d86a4
-rw-r--r--crates/ide_diagnostics/src/handlers/missing_fields.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/crates/ide_diagnostics/src/handlers/missing_fields.rs b/crates/ide_diagnostics/src/handlers/missing_fields.rs
index cc0b998068..f61ab1f410 100644
--- a/crates/ide_diagnostics/src/handlers/missing_fields.rs
+++ b/crates/ide_diagnostics/src/handlers/missing_fields.rs
@@ -64,6 +64,7 @@ fn fixes(ctx: &DiagnosticsContext<'_>, d: &hir::MissingFields) -> Option<Vec<Ass
let missing_fields = ctx.sema.record_literal_missing_fields(&field_list_parent);
for (f, ty) in missing_fields.iter() {
let field_expr = if let Some(local_candidate) = locals.get(&f.name(ctx.sema.db)) {
+ cov_mark::hit!(field_shorthand);
let candidate_ty = local_candidate.ty(ctx.sema.db);
if ty.could_unify_with(ctx.sema.db, &candidate_ty) {
None
@@ -344,6 +345,7 @@ fn f() {
#[test]
fn test_fill_struct_fields_shorthand() {
+ cov_mark::check!(field_shorthand);
check_fix(
r#"
struct S { a: &'static str, b: i32 }