aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/utils/rust_diagnostics.ts
diff options
context:
space:
mode:
authorRyan Cumming <[email protected]>2019-06-25 12:44:27 +0100
committerRyan Cumming <[email protected]>2019-06-25 12:44:27 +0100
commit5c6ab1145319414e897a8eaca2bf1ad5558ccf24 (patch)
tree5a760afdfc07aa4c6e4ae67cb5f0983020453606 /editors/code/src/utils/rust_diagnostics.ts
parentd997fd8ea510f364719b51dc5d8a77b0fcf1b3d3 (diff)
Tweak isUnusedOrUnnecessary
The first cut was a bit rough with the blanket `unused_*` rule. This trigger for things like `unused_mut` where the code is used but it's suboptimal. It's misleading to grey out the code in those cases. Instead, use an explicit list of things known to be dead code.
Diffstat (limited to 'editors/code/src/utils/rust_diagnostics.ts')
-rw-r--r--editors/code/src/utils/rust_diagnostics.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/editors/code/src/utils/rust_diagnostics.ts b/editors/code/src/utils/rust_diagnostics.ts
index 7d8cc0e0b..ed049c95e 100644
--- a/editors/code/src/utils/rust_diagnostics.ts
+++ b/editors/code/src/utils/rust_diagnostics.ts
@@ -95,8 +95,14 @@ function isUnusedOrUnnecessary(rd: RustDiagnostic): boolean {
95 return false; 95 return false;
96 } 96 }
97 97
98 const { code } = rd.code; 98 return [
99 return code.startsWith('unused_') || code === 'dead_code'; 99 'dead_code',
100 'unknown_lints',
101 'unused_attributes',
102 'unused_imports',
103 'unused_macros',
104 'unused_variables'
105 ].includes(rd.code.code);
100} 106}
101 107
102/** 108/**