aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/utils/diagnostics/rust.ts
diff options
context:
space:
mode:
authorLaurenČ›iu Nicola <[email protected]>2019-12-09 18:57:55 +0000
committerLaurenČ›iu Nicola <[email protected]>2019-12-09 19:07:19 +0000
commit273299693b85996878907ad256ed55f072ec3f1a (patch)
tree16d7de77952895b4cebf1cbb7a18652eaf4d98b6 /editors/code/src/utils/diagnostics/rust.ts
parent897b550049d8889804bb476e305427d07879cd63 (diff)
Code: enable prettier trailing commas
Diffstat (limited to 'editors/code/src/utils/diagnostics/rust.ts')
-rw-r--r--editors/code/src/utils/diagnostics/rust.ts20
1 files changed, 10 insertions, 10 deletions
diff --git a/editors/code/src/utils/diagnostics/rust.ts b/editors/code/src/utils/diagnostics/rust.ts
index 0550d0372..b6efc0f56 100644
--- a/editors/code/src/utils/diagnostics/rust.ts
+++ b/editors/code/src/utils/diagnostics/rust.ts
@@ -7,7 +7,7 @@ export enum SuggestionApplicability {
7 MachineApplicable = 'MachineApplicable', 7 MachineApplicable = 'MachineApplicable',
8 HasPlaceholders = 'HasPlaceholders', 8 HasPlaceholders = 'HasPlaceholders',
9 MaybeIncorrect = 'MaybeIncorrect', 9 MaybeIncorrect = 'MaybeIncorrect',
10 Unspecified = 'Unspecified' 10 Unspecified = 'Unspecified',
11} 11}
12 12
13// Reference: 13// Reference:
@@ -69,7 +69,7 @@ function mapSpanToLocation(span: RustDiagnosticSpan): vscode.Location {
69 69
70 const range = new vscode.Range( 70 const range = new vscode.Range(
71 new vscode.Position(span.line_start - 1, span.column_start - 1), 71 new vscode.Position(span.line_start - 1, span.column_start - 1),
72 new vscode.Position(span.line_end - 1, span.column_end - 1) 72 new vscode.Position(span.line_end - 1, span.column_end - 1),
73 ); 73 );
74 74
75 return new vscode.Location(fileUri, range); 75 return new vscode.Location(fileUri, range);
@@ -81,7 +81,7 @@ function mapSpanToLocation(span: RustDiagnosticSpan): vscode.Location {
81 * If the span is unlabelled this will return `undefined`. 81 * If the span is unlabelled this will return `undefined`.
82 */ 82 */
83function mapSecondarySpanToRelated( 83function mapSecondarySpanToRelated(
84 span: RustDiagnosticSpan 84 span: RustDiagnosticSpan,
85): vscode.DiagnosticRelatedInformation | undefined { 85): vscode.DiagnosticRelatedInformation | undefined {
86 if (!span.label) { 86 if (!span.label) {
87 // Nothing to label this with 87 // Nothing to label this with
@@ -107,7 +107,7 @@ function isUnusedOrUnnecessary(rd: RustDiagnostic): boolean {
107 'unused_attributes', 107 'unused_attributes',
108 'unused_imports', 108 'unused_imports',
109 'unused_macros', 109 'unused_macros',
110 'unused_variables' 110 'unused_variables',
111 ].includes(rd.code.code); 111 ].includes(rd.code.code);
112} 112}
113 113
@@ -157,13 +157,13 @@ function mapRustChildDiagnostic(rd: RustDiagnostic): MappedRustChildDiagnostic {
157 title, 157 title,
158 location, 158 location,
159 span.suggested_replacement, 159 span.suggested_replacement,
160 span.suggestion_applicability 160 span.suggestion_applicability,
161 ) 161 ),
162 }; 162 };
163 } else { 163 } else {
164 const related = new vscode.DiagnosticRelatedInformation( 164 const related = new vscode.DiagnosticRelatedInformation(
165 location, 165 location,
166 rd.message 166 rd.message,
167 ); 167 );
168 168
169 return { related }; 169 return { related };
@@ -183,7 +183,7 @@ function mapRustChildDiagnostic(rd: RustDiagnostic): MappedRustChildDiagnostic {
183 * If the diagnostic has no primary span this will return `undefined` 183 * If the diagnostic has no primary span this will return `undefined`
184 */ 184 */
185export function mapRustDiagnosticToVsCode( 185export function mapRustDiagnosticToVsCode(
186 rd: RustDiagnostic 186 rd: RustDiagnostic,
187): MappedRustDiagnostic | undefined { 187): MappedRustDiagnostic | undefined {
188 const primarySpan = rd.spans.find(s => s.is_primary); 188 const primarySpan = rd.spans.find(s => s.is_primary);
189 if (!primarySpan) { 189 if (!primarySpan) {
@@ -223,7 +223,7 @@ export function mapRustDiagnosticToVsCode(
223 const suggestedFixes = []; 223 const suggestedFixes = [];
224 for (const child of rd.children) { 224 for (const child of rd.children) {
225 const { related, suggestedFix, messageLine } = mapRustChildDiagnostic( 225 const { related, suggestedFix, messageLine } = mapRustChildDiagnostic(
226 child 226 child,
227 ); 227 );
228 228
229 if (related) { 229 if (related) {
@@ -256,6 +256,6 @@ export function mapRustDiagnosticToVsCode(
256 return { 256 return {
257 location, 257 location,
258 diagnostic: vd, 258 diagnostic: vd,
259 suggestedFixes 259 suggestedFixes,
260 }; 260 };
261} 261}