Added unfulfilled_lint_expectations lint for (RFC-2383)

This commit is contained in:
xFrednet 2021-08-06 23:23:34 +02:00
parent 9fef3d9e0a
commit f467a58b7b
No known key found for this signature in database
GPG key ID: FCDCBF29AF64D601

View file

@ -495,6 +495,39 @@ declare_lint! {
"unrecognized lint attribute"
}
declare_lint! {
/// The `unfulfilled_lint_expectations` lint detects lint trigger expectations
/// that have not been fulfilled.
///
/// ### Example
///
/// ```rust
/// #![feature(lint_reasons)]
///
/// #[expect(unused_variables)]
/// let x = 10;
/// println!("{}", x);
/// ```
///
/// {{produces}}
///
/// ### Explanation
///
/// It was expected that the marked code would emit a lint. This expectation
/// has not been fulfilled.
///
/// The `expect` attribute can be removed if this is intended behavior otherwise
/// it should be investigated why the expected lint is no longer issued.
///
/// Part of RFC 2383. The progress is being tracked in [#54503]
///
/// [#54503]: https://github.com/rust-lang/rust/issues/54503
pub UNFULFILLED_LINT_EXPECTATIONS,
Warn,
"unfulfilled lint expectation",
@feature_gate = rustc_span::sym::lint_reasons;
}
declare_lint! {
/// The `unused_variables` lint detects variables which are not used in
/// any way.
@ -3007,6 +3040,7 @@ declare_lint_pass! {
UNUSED_CRATE_DEPENDENCIES,
UNUSED_QUALIFICATIONS,
UNKNOWN_LINTS,
UNFULFILLED_LINT_EXPECTATIONS,
UNUSED_VARIABLES,
UNUSED_ASSIGNMENTS,
DEAD_CODE,