pub struct DiagnosticsRulesConfig {
pub missing_footnote: RuleConfig,
pub unused_footnote: RuleConfig,
pub table_inconsistent_columns: RuleConfig,
pub forbidden_label_prefix: RuleConfig,
pub unknown_lex_canonical: RuleConfig,
pub spellcheck: RuleConfig,
pub schema: SchemaRulesConfig,
}Expand description
Per-rule severity for diagnostics.
One field per built-in diagnostic code. Each field’s doc comment is
the description that surfaces in lexd config gen output, so
authoring conventions for these doc comments matter: write them as
user-facing prose, lead with what triggers the diagnostic, finish
with the intrinsic default.
RuleConfig is a serde-untagged sum ("warn" or
["warn", { max = 80 }]), so every field carries #[clapfig(value)]
— the leaf is a LeafType::Value escape hatch in the schema, and
serde does the shape validation on deserialize. clapfig’s typo
detection on the field names themselves still applies: a
misspelled built-in like missing_footote is rejected as an unknown
key. Extension-emitted codes (<namespace>.<code>) ride in via
on_unknown_key and a side-channel populated by the loader — they
are not fields on this struct.
Default returns every field at Severity::Warn regardless of
each rule’s intrinsic default. Real production loads run through
clapfig and honour the #[clapfig(default = "...")] annotations.
Default is here so tests and ad-hoc embedders can construct an
instance without going through the clapfig pipeline.
Fields§
§missing_footnote: RuleConfigA footnote reference like [42] has no corresponding
definition in the document. Intrinsic default: deny.
unused_footnote: RuleConfigA footnote definition appears in the document but no reference points at it. Intrinsic default: warn.
table_inconsistent_columns: RuleConfigA table row has a different number of columns than the table’s header row. Intrinsic default: warn.
forbidden_label_prefix: RuleConfigA label uses the reserved doc.* prefix, which is no longer
valid under the current label policy. Intrinsic default: deny.
unknown_lex_canonical: RuleConfigA lex.* literal references a canonical that the toolchain
does not recognise — typically a typo or a label written for
a future core schema. Intrinsic default: deny.
spellcheck: RuleConfigSpellcheck diagnostics. Intrinsic default: warn. Currently
not consulted at emission time — spellcheck emits through a
separate path in lex-analysis::spellcheck. The field is
present so the value lives in the user-facing config schema;
runtime wiring lands when spellcheck moves over to the
AnalysisDiagnostic / DiagnosticKind pipeline.
schema: SchemaRulesConfigSchema-validation diagnostics for extension labels.
Implementations§
Source§impl DiagnosticsRulesConfig
impl DiagnosticsRulesConfig
Sourcepub fn lookup_by_code(&self, code: &str) -> Option<&RuleConfig>
pub fn lookup_by_code(&self, code: &str) -> Option<&RuleConfig>
Look up a rule by its on-the-wire code (e.g. "missing-footnote"
or "schema.unknown-label").
Only consults named built-in fields. Extension-emitted codes
(<namespace>.<code>) live in a separate side-channel map
populated by the loader’s on_unknown_key callback and stored
on LoadedLexConfig::extension_diagnostic_rules; use
LoadedLexConfig::lookup_diagnostic_rule to consult both
surfaces with a single call.
Trait Implementations§
Source§impl Clone for DiagnosticsRulesConfig
impl Clone for DiagnosticsRulesConfig
Source§fn clone(&self) -> DiagnosticsRulesConfig
fn clone(&self) -> DiagnosticsRulesConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DiagnosticsRulesConfig
impl Debug for DiagnosticsRulesConfig
Source§impl Default for DiagnosticsRulesConfig
impl Default for DiagnosticsRulesConfig
Source§fn default() -> DiagnosticsRulesConfig
fn default() -> DiagnosticsRulesConfig
Source§impl<'de> Deserialize<'de> for DiagnosticsRulesConfig
impl<'de> Deserialize<'de> for DiagnosticsRulesConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Schema for DiagnosticsRulesConfig
impl Schema for DiagnosticsRulesConfig
Source§const STATIC: &'static SchemaStatic
const STATIC: &'static SchemaStatic
static SchemaStatic = ... initializers.Source§fn schema() -> &'static Schema
fn schema() -> &'static Schema
OnceLock; the helper cached_runtime_schema keeps the
generated body small.Source§fn schema_arc() -> Arc<Schema>
fn schema_arc() -> Arc<Schema>
Arc-flavored access to the same cached runtime view. Used by the
macro-driven builder (crate::SchemaConfigBuilder) to avoid
cloning the schema tree per builder construction — the runtime
spec stores an Arc<Schema> and the cache hands out cheap
reference-counted handles to it. Cost: one Arc::clone per call
(atomic increment, no allocation).Source§fn schema_static() -> &'static SchemaStatic
fn schema_static() -> &'static SchemaStatic
Self::STATIC.Source§fn field_paths() -> Vec<String>
fn field_paths() -> Vec<String>
--list-keys flags) replace hand-maintained “known paths”
constants — the macro recomputes the list every time a field is
added or removed. Read moreAuto Trait Implementations§
impl Freeze for DiagnosticsRulesConfig
impl RefUnwindSafe for DiagnosticsRulesConfig
impl Send for DiagnosticsRulesConfig
impl Sync for DiagnosticsRulesConfig
impl Unpin for DiagnosticsRulesConfig
impl UnsafeUnpin for DiagnosticsRulesConfig
impl UnwindSafe for DiagnosticsRulesConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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