MCPcopy Create free account
hub / github.com/csskit/csskit / into_diagnostic

Method into_diagnostic

crates/css_parse/src/diagnostics.rs:110–119  ·  view source on GitHub ↗
(self, source: &str)

Source from the content-addressed store, hash-verified

108 /// Convert to a full miette diagnostic for display
109 #[cfg(feature = "miette")]
110 pub fn into_diagnostic(self, source: &str) -> MietteDiagnostic {
111 use miette::LabeledSpan;
112 let DiagnosticMeta { code, message, help, mut labels } = (self.formatter)(&self, source);
113 let miette_labels = labels.drain(0..).map(|(span, label)| LabeledSpan::new_with_span(Some(label), span));
114 MietteDiagnostic::new(message)
115 .with_code(code)
116 .with_severity(self.severity.into())
117 .with_help(help)
118 .with_labels(miette_labels)
119 }
120
121 // Fomatting functions
122

Callers 2

build_errorFunction · 0.80
format_diagnostic_errorFunction · 0.80

Calls 1

with_severityMethod · 0.80

Tested by

no test coverage detected