diff options
Diffstat (limited to 'bin')
-rw-r--r-- | bin/Cargo.toml | 2 | ||||
-rw-r--r-- | bin/src/traits.rs | 14 |
2 files changed, 12 insertions, 4 deletions
diff --git a/bin/Cargo.toml b/bin/Cargo.toml index 3bbc532..cc15c23 100644 --- a/bin/Cargo.toml +++ b/bin/Cargo.toml | |||
@@ -1,6 +1,6 @@ | |||
1 | [package] | 1 | [package] |
2 | name = "statix" | 2 | name = "statix" |
3 | version = "0.2.4" | 3 | version = "0.2.5" |
4 | edition = "2018" | 4 | edition = "2018" |
5 | license = "MIT" | 5 | license = "MIT" |
6 | authors = [ "Akshay <[email protected]>" ] | 6 | authors = [ "Akshay <[email protected]>" ] |
diff --git a/bin/src/traits.rs b/bin/src/traits.rs index 5068764..465abe4 100644 --- a/bin/src/traits.rs +++ b/bin/src/traits.rs | |||
@@ -118,7 +118,6 @@ mod json { | |||
118 | 118 | ||
119 | use std::io::{self, Write}; | 119 | use std::io::{self, Write}; |
120 | 120 | ||
121 | use lib::Suggestion; | ||
122 | use rnix::TextRange; | 121 | use rnix::TextRange; |
123 | use serde::Serialize; | 122 | use serde::Serialize; |
124 | use serde_json; | 123 | use serde_json; |
@@ -142,7 +141,13 @@ mod json { | |||
142 | struct JsonDiagnostic<'μ> { | 141 | struct JsonDiagnostic<'μ> { |
143 | at: JsonSpan, | 142 | at: JsonSpan, |
144 | message: &'μ String, | 143 | message: &'μ String, |
145 | suggestion: &'μ Option<Suggestion>, | 144 | suggestion: Option<JsonSuggestion>, |
145 | } | ||
146 | |||
147 | #[derive(Serialize)] | ||
148 | struct JsonSuggestion { | ||
149 | at: JsonSpan, | ||
150 | fix: String, | ||
146 | } | 151 | } |
147 | 152 | ||
148 | #[derive(Serialize)] | 153 | #[derive(Serialize)] |
@@ -193,7 +198,10 @@ mod json { | |||
193 | .map(|d| JsonDiagnostic { | 198 | .map(|d| JsonDiagnostic { |
194 | at: JsonSpan::from_textrange(d.at, src), | 199 | at: JsonSpan::from_textrange(d.at, src), |
195 | message: &d.message, | 200 | message: &d.message, |
196 | suggestion: &d.suggestion, | 201 | suggestion: d.suggestion.as_ref().map(|s| JsonSuggestion { |
202 | at: JsonSpan::from_textrange(s.at, src), | ||
203 | fix: s.fix.to_string(), | ||
204 | }), | ||
197 | }) | 205 | }) |
198 | .collect::<Vec<_>>(); | 206 | .collect::<Vec<_>>(); |
199 | JsonReport { | 207 | JsonReport { |