aboutsummaryrefslogtreecommitdiff
path: root/bin/src/traits.rs
diff options
context:
space:
mode:
Diffstat (limited to 'bin/src/traits.rs')
-rw-r--r--bin/src/traits.rs18
1 files changed, 7 insertions, 11 deletions
diff --git a/bin/src/traits.rs b/bin/src/traits.rs
index 1807ad0..c3427df 100644
--- a/bin/src/traits.rs
+++ b/bin/src/traits.rs
@@ -3,19 +3,14 @@ use std::{
3 str, 3 str,
4}; 4};
5 5
6use crate::lint::LintResult;
7
6use ariadne::{ 8use ariadne::{
7 CharSet, Color, Config as CliConfig, Label, LabelAttach, Report as CliReport, 9 CharSet, Color, Config as CliConfig, Fmt, Label, LabelAttach, Report as CliReport,
8 ReportKind as CliReportKind, Source, Fmt 10 ReportKind as CliReportKind, Source,
9}; 11};
10use lib::Report;
11use rnix::TextRange; 12use rnix::TextRange;
12use vfs::{FileId, ReadOnlyVfs}; 13use vfs::ReadOnlyVfs;
13
14#[derive(Debug)]
15pub struct LintResult {
16 pub file_id: FileId,
17 pub reports: Vec<Report>,
18}
19 14
20pub trait WriteDiagnostic { 15pub trait WriteDiagnostic {
21 fn write(&mut self, report: &LintResult, vfs: &ReadOnlyVfs) -> io::Result<()>; 16 fn write(&mut self, report: &LintResult, vfs: &ReadOnlyVfs) -> io::Result<()>;
@@ -69,7 +64,8 @@ where
69 64
70// everything within backticks is colorized, backticks are removed 65// everything within backticks is colorized, backticks are removed
71fn colorize(message: &str) -> String { 66fn colorize(message: &str) -> String {
72 message.split('`') 67 message
68 .split('`')
73 .enumerate() 69 .enumerate()
74 .map(|(idx, part)| { 70 .map(|(idx, part)| {
75 if idx % 2 == 1 { 71 if idx % 2 == 1 {