Add coverage mark for struct init shorthand test

This commit is contained in:
nathan.whitaker 2021-08-30 14:37:03 -04:00
parent e4757f9407
commit e1d86a42fe

View file

@ -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 }