1
Fork 0

Support lint expectations for --force-warn lints (RFC 2383)

This commit is contained in:
xFrednet 2022-06-05 12:33:45 +02:00
parent ec55c61305
commit 8527a3d369
No known key found for this signature in database
GPG key ID: F5C59D0E669E5302
19 changed files with 317 additions and 71 deletions

View file

@ -1432,7 +1432,7 @@ pub fn get_cmd_lint_options(
let mut lint_opts_with_position = vec![];
let mut describe_lints = false;
for level in [lint::Allow, lint::Warn, lint::ForceWarn, lint::Deny, lint::Forbid] {
for level in [lint::Allow, lint::Warn, lint::ForceWarn(None), lint::Deny, lint::Forbid] {
for (arg_pos, lint_name) in matches.opt_strs_pos(level.as_str()) {
if lint_name == "help" {
describe_lints = true;

View file

@ -286,6 +286,14 @@ impl Session {
) -> DiagnosticBuilder<'_, ()> {
self.diagnostic().struct_span_warn(sp, msg)
}
pub fn struct_span_warn_with_expectation<S: Into<MultiSpan>>(
&self,
sp: S,
msg: impl Into<DiagnosticMessage>,
id: lint::LintExpectationId,
) -> DiagnosticBuilder<'_, ()> {
self.diagnostic().struct_span_warn_with_expectation(sp, msg, id)
}
pub fn struct_span_warn_with_code<S: Into<MultiSpan>>(
&self,
sp: S,
@ -297,6 +305,13 @@ impl Session {
pub fn struct_warn(&self, msg: impl Into<DiagnosticMessage>) -> DiagnosticBuilder<'_, ()> {
self.diagnostic().struct_warn(msg)
}
pub fn struct_warn_with_expectation(
&self,
msg: impl Into<DiagnosticMessage>,
id: lint::LintExpectationId,
) -> DiagnosticBuilder<'_, ()> {
self.diagnostic().struct_warn_with_expectation(msg, id)
}
pub fn struct_span_allow<S: Into<MultiSpan>>(
&self,
sp: S,