Skip to main content

Lint

Enum Lint 

Source
#[non_exhaustive]
pub enum Lint {
Show 23 variants ExtraId, UndeclaredVariable, UndeclaredMarkup, DroppedMarkup, DynamicSelect, BadOptionValue, GatedFunction, DoNotTranslate, DuplicateId, LocaleMismatch, UnknownFunction, MissingTranslation, NeutralNumbers, UnpairedMarkup, MissingPluralCategory, NonNfcSource, DroppedPlaceholder, UnknownOption, UnusedId, SuspiciousBidi, DynamicCurrency, DynamicUnit, NonstandardName,
}
Expand description

One check mf2 check makes.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

ExtraId

A translation has an id the source locale does not.

§

UndeclaredVariable

A translation uses a variable the source message does not declare. A language that needs more input (grammatical gender, say) gets it by the source declaring it with .input, even where its own pattern ignores it.

§

UndeclaredMarkup

A translation uses a markup name the source message does not.

§

DroppedMarkup

A translation leaves out markup the source message has: a {#link}terms{/link} gone from the French sentence takes the link away from French readers, and nothing at run time says so. An error by default, where a dropped placeholder is a warning — a plural variant routinely drops {$count} (“one” says “a message”), and nothing routinely drops a link; a corpus that drops emphasis on purpose may turn it down.

§

DynamicSelect

A select option is not a literal, so nothing can tell which rules a message selects by until it runs. An error by default: the catalog then has to carry both plural rule sets, and the message reports a Bad Option anyway. A corpus that means it may turn it down.

§

BadOptionValue

A well-known option has a literal value it cannot take. An error by default, though the runtime would report Bad Option on its own — the suite has messages that do exactly that on purpose.

§

GatedFunction

A function whose client feature is off — :percent, :currency and :unit without fn-number, :datetime, :date and :time without fn-datetime. A translation can never silently add formatting code to the wasm (plans/03-runtime.md §5.1).

§

DoNotTranslate

An entry marked @do-not-translate differs from the source’s.

§

DuplicateId

Two entries of one locale have the same id, so one of them would be silently dropped.

§

LocaleMismatch

A file declares an @locale other than the directory it sits in. An error by default — it is nearly always a copy that was never finished — but a corpus that keeps one locale’s files under another tag on purpose may turn it down.

§

UnknownFunction

A function no registered crate provides. An error by default and configurable, since custom functions are legal.

§

MissingTranslation

An id the source locale has and a translation does not: it falls back.

§

NeutralNumbers

A placeholder can receive a number and fn-number is off, so a number renders without the locale’s symbols. The build cannot see what an application passes, so a placeholder that only receives text raises it too.

§

UnpairedMarkup

Markup opened and not closed, or closed and not opened.

§

MissingPluralCategory

A plural .match that does not mention every category the target locale has.

§

NonNfcSource

Source text that is not in NFC.

§

DroppedPlaceholder

A placeholder the source has and a translation dropped.

§

UnknownOption

An option a built-in function does not define — dateStyle on :datetime, say. MF2 ignores it, so the message formats as though it were not there, and nothing at run time says so.

§

UnusedId

An id no tr! in the workspace names.

§

SuspiciousBidi

Unpaired bidi isolates in literal text.

§

DynamicCurrency

A :currency whose currency option is not a literal, so the catalog must carry every currency CLDR has; listing the codes it can hold in mf2.toml [locale_data] carries only those and silences this (plans/02-catalog-format.md §4.4).

§

DynamicUnit

The same for :unit.

§

NonstandardName

A variable, option, function, markup or attribute name that is not a Unicode identifier under MF2’s profile of UAX #31, uses a character UTS #39’s General Security Profile does not allow, or mixes scripts — syntax.md asks linters to warn on exactly these.

Implementations§

Source§

impl Lint

Source

pub const ALL: &'static [Lint]

Every lint, in declaration order.

Source

pub fn name(self) -> &'static str

The name mf2.toml and a report use.

Source

pub fn default_level(self) -> Level

What it does when mf2.toml says nothing.

Source

pub fn floor(self) -> Level

The lowest level mf2.toml may set it to. A lint whose floor is Level::Error states a rule the rest of the pipeline relies on — a build that ignored it could not produce a correct catalog — so it cannot be turned down.

Source

pub fn from_name(name: &str) -> Option<Lint>

The lint named name.

Trait Implementations§

Source§

impl Clone for Lint

Source§

fn clone(&self) -> Self

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 Copy for Lint

Source§

impl Debug for Lint

Source§

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

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

impl<'de> Deserialize<'de> for Lint

Source§

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

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Lint

Source§

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

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

impl Eq for Lint

Source§

impl Hash for Lint

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Lint

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for Lint

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for Lint

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for Lint

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Lint

Auto Trait Implementations§

§

impl Freeze for Lint

§

impl RefUnwindSafe for Lint

§

impl Send for Lint

§

impl Sync for Lint

§

impl Unpin for Lint

§

impl UnsafeUnpin for Lint

§

impl UnwindSafe for Lint

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> ErasedDestructor for T
where T: 'static,

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.