diff options
Diffstat (limited to 'editors/code/src/utils/diagnostics')
-rw-r--r-- | editors/code/src/utils/diagnostics/rust.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/editors/code/src/utils/diagnostics/rust.ts b/editors/code/src/utils/diagnostics/rust.ts index d16576eb1..bfb494a3a 100644 --- a/editors/code/src/utils/diagnostics/rust.ts +++ b/editors/code/src/utils/diagnostics/rust.ts | |||
@@ -103,6 +103,7 @@ function isUnusedOrUnnecessary(rd: RustDiagnostic): boolean { | |||
103 | return [ | 103 | return [ |
104 | 'dead_code', | 104 | 'dead_code', |
105 | 'unknown_lints', | 105 | 'unknown_lints', |
106 | 'unreachable_code', | ||
106 | 'unused_attributes', | 107 | 'unused_attributes', |
107 | 'unused_imports', | 108 | 'unused_imports', |
108 | 'unused_macros', | 109 | 'unused_macros', |
@@ -182,6 +183,7 @@ export function mapRustDiagnosticToVsCode( | |||
182 | const secondarySpans = rd.spans.filter(s => !s.is_primary); | 183 | const secondarySpans = rd.spans.filter(s => !s.is_primary); |
183 | 184 | ||
184 | const severity = mapLevelToSeverity(rd.level); | 185 | const severity = mapLevelToSeverity(rd.level); |
186 | let primarySpanLabel = primarySpan.label; | ||
185 | 187 | ||
186 | const vd = new vscode.Diagnostic(location.range, rd.message, severity); | 188 | const vd = new vscode.Diagnostic(location.range, rd.message, severity); |
187 | 189 | ||
@@ -220,9 +222,17 @@ export function mapRustDiagnosticToVsCode( | |||
220 | } | 222 | } |
221 | if (messageLine) { | 223 | if (messageLine) { |
222 | vd.message += `\n${messageLine}`; | 224 | vd.message += `\n${messageLine}`; |
225 | |||
226 | // These secondary messages usually duplicate the content of the | ||
227 | // primary span label. | ||
228 | primarySpanLabel = undefined; | ||
223 | } | 229 | } |
224 | } | 230 | } |
225 | 231 | ||
232 | if (primarySpanLabel) { | ||
233 | vd.message += `\n${primarySpanLabel}`; | ||
234 | } | ||
235 | |||
226 | if (isUnusedOrUnnecessary(rd)) { | 236 | if (isUnusedOrUnnecessary(rd)) { |
227 | vd.tags = [vscode.DiagnosticTag.Unnecessary]; | 237 | vd.tags = [vscode.DiagnosticTag.Unnecessary]; |
228 | } | 238 | } |