8000 Add WarningDiagnostic::emit (#668) · rune-rs/rune@8e69882 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8e69882

Browse files
authored
Add WarningDiagnostic::emit (#668)
1 parent d3b93c1 commit 8e69882

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

crates/rune/src/diagnostics/emit.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,20 @@ impl FatalDiagnostic {
286286
}
287287
}
288288

289+
impl WarningDiagnostic {
290+
/// Generate formatted diagnostics capable of referencing source lines and
291+
/// hints.
292+
///
293+
/// See [prepare][crate::prepare] for how to use.
294+
pub fn emit<O>(&self, out: &mut O, sources: &Sources) -> Result<(), EmitError>
295+
where
296+
O: WriteColor,
297+
{
298+
let config = term::Config::default();
299+
warning_diagnostics_emit(self, out, sources, &config)
300+
}
301+
}
302+
289303
impl Unit {
290304
/// Dump instructions in a human readable manner.
291305
pub fn emit_instructions<O>(

0 commit comments

Comments
 (0)
0