Improve unexpected_cfgs lint when their is no value expected

This commit is contained in:
Loïc BRANSTETT 2022-03-03 15:56:19 +01:00
parent 86067bb461
commit 92544f43b0
7 changed files with 52 additions and 29 deletions

View file

@ -476,7 +476,7 @@ pub fn cfg_matches(
cfg.span,
lint_node_id,
"unexpected `cfg` condition name",
BuiltinLintDiagnostics::UnexpectedCfg(ident.span, name, None),
BuiltinLintDiagnostics::UnexpectedCfg((name, ident.span), None),
);
}
}
@ -489,9 +489,8 @@ pub fn cfg_matches(
lint_node_id,
"unexpected `cfg` condition value",
BuiltinLintDiagnostics::UnexpectedCfg(
cfg.name_value_literal_span().unwrap(),
name,
Some(value),
(name, ident.span),
Some((value, cfg.name_value_literal_span().unwrap())),
),
);
}