Struct marker_api::Lint
source · #[repr(C)]pub struct Lint {
pub name: &'static str,
pub default_level: Level,
pub explanation: &'static str,
pub report_in_macro: MacroReport,
pub fqn: &'static str,
pub _unstable_i_accept_the_risk_of_instability: (),
}
Expand description
This struct defines a lint.
It should never be constructed directly, the declare_lint
macro should be used instead, like this:
marker_api::declare_lint!{
/// # What it does
/// Here you can describe what your lint does.
///
/// # Example
/// ```
/// <bad example>
/// ```
///
/// Use instead
/// ```
/// <bad example>
/// ```
ITEM_WITH_TEST_NAME,
Warn,
}
The fields of this struct are public, to allow the instantiation in constant
context. Marker reserves the right to add new fields, as long the lint can still
be constructed using the declare_lint
macro.
Fields§
§name: &'static str
The string identifier of this lint.
Identifiers use underscores, to connect multiple words, e.g., “unused_imports”. Lint names in console arguments use dashes instead of underscores. These are automatically converted to underscores internally.
Identifiers in Marker are split into three parts:
- The
marker
prefix, specifying that the lint comes from Marker - The lint crate name, as an infix
- The name of the lint, as the postfix
See https://rustc-dev-guide.rust-lang.org/diagnostics.html#lint-naming for naming guidelines.
default_level: Level
Default level for the lint.
See https://rustc-dev-guide.rust-lang.org/diagnostics.html#diagnostic-levels for guidelines on choosing a default level.
explanation: &'static str
Description of the lint or the issue it detects.
e.g., “imports that are never used”
report_in_macro: MacroReport
The level of macro reporting.
See MacroReport
for the possible levels.
fqn: &'static str
Fully qualiefied name of the static variable that defines the lint. It includes the module and the name of the variable.
_unstable_i_accept_the_risk_of_instability: ()
This struct should always be instantiated using the declare_lint
macro. This value is simply here, to force any construction to acknowledge the
instability of manual construction.