Skip to main content

LintConfig

Struct LintConfig 

Source
pub struct LintConfig {
    pub rules: BTreeMap<String, Level>,
    pub strict: Option<bool>,
}
Expand description

[lint] — which rules run at what level, and whether what they report stops the run.

The two keys are the same question at two grains: rules names one rule, strict promotes every warn of a run at once.

Fields§

§rules: BTreeMap<String, Level>

[lint.rules] — the level of each rule this project has an opinion about.

A key is any entry of crate::lint::RULES — one of htl’s own rules, or one of the vendored Teal compiler’s warning kinds under its tl: prefix ("tl:hint", "tl:unused", …, which have to be quoted because : is not a bare TOML key). htl check --list-lints prints them all with their defaults. A value is "allow", "warn" or "deny". An unknown name or level is refused rather than ignored: a typo that turned nothing on would read exactly like a rule that found nothing, and a misspelt "deny" would read like a run that passed.

One place per rule says everything about that rule. The enable / disable lists this replaced said it in two places that had to be read together, and neither could say what a rule was worth. A rule this table does not name keeps its default level.

§strict: Option<bool>

true: every finding this run reports at warn counts as deny, so Teal’s warnings and htl’s lints fail htl check; lints also fail include_tl! (the macro reports Teal’s warnings and builds anyway). false: advisory everywhere (including the macro, whose built-in default is strict), except for a rule the project set to deny, which fails htl check with or without this key.

A run-wide promotion rather than a concept of its own: strict and a [lint.rules] level are the same question asked at two grains.

htl test does not read it, by design: a test run’s verdict is its tests, plus the type errors that stop a file from running at all. Warnings and lints are still reported there; htl check is where they are judged.

Trait Implementations§

Source§

impl Clone for LintConfig

Source§

fn clone(&self) -> LintConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LintConfig

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for LintConfig

Source§

fn default() -> LintConfig

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for LintConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> MaybeSend for T

Source§

impl<T> MaybeSync for T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.