Skip to main content

Rule

Trait Rule 

Source
pub trait Rule: Send + Sync {
    // Required methods
    fn id(&self) -> &'static str;
    fn description(&self) -> &'static str;
    fn explanation(&self) -> &'static str;
    fn examples(&self) -> &'static [Example];
    fn exceptable_nodes(&self) -> Option<&'static [SyntaxKind]>;
    fn deny(&mut self);
    fn severity(&self) -> Severity;
}
Expand description

A trait implemented by analysis rules.

Required Methods§

Source

fn id(&self) -> &'static str

The unique identifier for the rule.

The identifier is required to be pascal case and it is the identifier by which a rule is excepted or denied.

Source

fn description(&self) -> &'static str

A short, single sentence description of the rule.

Source

fn explanation(&self) -> &'static str

Get the long-form explanation of the rule.

Source

fn examples(&self) -> &'static [Example]

Get a list of examples that would trigger this rule.

Source

fn exceptable_nodes(&self) -> Option<&'static [SyntaxKind]>

Gets the nodes that are exceptable for this rule.

If None is returned, all nodes are exceptable.

Source

fn deny(&mut self)

Denies the rule.

Denying the rule treats any diagnostics it emits as an error.

Source

fn severity(&self) -> Severity

Gets the severity of the rule.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§