LintStore

Struct LintStore 

Source
pub struct LintStore {
    config: LintConfiguration,
    lint_constructors: Vec<fn(&LintRuleConfiguration) -> Box<dyn LintRule>>,
    initialized_lints: BTreeMap<String, Box<dyn LintRule>>,
}
Expand description

The LintStore, which contains all available and known lint rules.

It can be used to further filter and select lints based on various criteria.

Fields§

§config: LintConfiguration§lint_constructors: Vec<fn(&LintRuleConfiguration) -> Box<dyn LintRule>>§initialized_lints: BTreeMap<String, Box<dyn LintRule>>

Implementations§

Source§

impl LintStore

Source

pub fn new(config: LintConfiguration) -> Self

Creates a new LintStore.

This adds all known lint rules to the store.

Source

fn register(&mut self)

Registers all lints that are made available in the store.

§Note

New lints must be specified in this function!

Source

fn initialize_lint_rules(&mut self)

Initializes and configures all linting rules.

This function instantly returns if the lints have already been initialized.

Source

pub fn lint_rules(&self) -> &BTreeMap<String, Box<dyn LintRule>>

Returns a reference to the map of all available and configured lint rules.

Source

pub fn lint_rule_by_name(&self, name: &ScopedName) -> Option<&Box<dyn LintRule>>

Returns a specific lint rule by its scoped name.

Returns None if no lint rule with a matching name exists.

Source

pub fn serializable_lint_rules(&self) -> BTreeMap<String, SerializableLintRule>

Returns a map of all available and configured lint rules as SerializableLintRule.

Source

pub fn filtered_lint_rules<'a>( &'a self, scope: &LintScope, max_level: Level, ) -> FilteredLintRules<'a>

Returns lint rules that match a filter consisting of LintScope and Level.

This function filters out all lint rules that are not explicitly included and

  • assigned to a deactivated group,
  • or have a level above the max_level,
  • or are explicitly ignored.

Trait Implementations§

Source§

impl Debug for LintStore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.