mirror of
https://github.com/typst/typst
synced 2025-05-21 04:25:28 +08:00
diag ids: remove categories, improve docs
This commit is contained in:
parent
afaa45e0e0
commit
eec6a3a0d1
@ -239,7 +239,7 @@ impl From<SyntaxError> for SourceDiagnostic {
|
||||
}
|
||||
}
|
||||
|
||||
/// Any possible identifier for a diagnostic.
|
||||
/// The identifier of a [`SourceDiagnostic`].
|
||||
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
|
||||
pub enum Identifier {
|
||||
/// Identifier for a built-in compiler warning.
|
||||
@ -248,6 +248,7 @@ pub enum Identifier {
|
||||
User(EcoString),
|
||||
}
|
||||
|
||||
/// Built-in compiler warnings.
|
||||
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
|
||||
pub enum CompilerWarning {
|
||||
UnnecessaryImportRenaming,
|
||||
@ -258,6 +259,8 @@ pub enum CompilerWarning {
|
||||
}
|
||||
|
||||
impl CompilerWarning {
|
||||
/// The name of the warning as a string, following the format of diagnostic
|
||||
/// identifiers.
|
||||
pub const fn name(&self) -> &'static str {
|
||||
match self {
|
||||
CompilerWarning::UnnecessaryImportRenaming => "unnecessary-import-renaming",
|
||||
@ -267,16 +270,6 @@ impl CompilerWarning {
|
||||
CompilerWarning::UnknownFontFamilies => "unknown-font-families",
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn categories(&self) -> &'_ [&'static str] {
|
||||
match self {
|
||||
CompilerWarning::UnnecessaryImportRenaming => &["unnecessary", "syntax"],
|
||||
CompilerWarning::UnnecessaryStars => &["unnecessary", "markup"],
|
||||
CompilerWarning::UnnecessaryUnderscores => &["unnecessary", "markup"],
|
||||
CompilerWarning::NonConvergingLayout => &["layout"],
|
||||
CompilerWarning::UnknownFontFamilies => &["fonts"],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Identifier {
|
||||
|
Loading…
x
Reference in New Issue
Block a user