diff options
Diffstat (limited to 'bin/src/traits.rs')
-rw-r--r-- | bin/src/traits.rs | 18 |
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 | ||
6 | use crate::lint::LintResult; | ||
7 | |||
6 | use ariadne::{ | 8 | use 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 | }; |
10 | use lib::Report; | ||
11 | use rnix::TextRange; | 12 | use rnix::TextRange; |
12 | use vfs::{FileId, ReadOnlyVfs}; | 13 | use vfs::ReadOnlyVfs; |
13 | |||
14 | #[derive(Debug)] | ||
15 | pub struct LintResult { | ||
16 | pub file_id: FileId, | ||
17 | pub reports: Vec<Report>, | ||
18 | } | ||
19 | 14 | ||
20 | pub trait WriteDiagnostic { | 15 | pub 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 |
71 | fn colorize(message: &str) -> String { | 66 | fn 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 { |