Skip to content

Commit 5c6ab11

Browse files
committed
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.
1 parent d997fd8 commit 5c6ab11

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

editors/code/src/utils/rust_diagnostics.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,14 @@ function isUnusedOrUnnecessary(rd: RustDiagnostic): boolean {
9595
return false;
9696
}
9797

98-
const { code } = rd.code;
99-
return code.startsWith('unused_') || code === 'dead_code';
98+
return [
99+
'dead_code',
100+
'unknown_lints',
101+
'unused_attributes',
102+
'unused_imports',
103+
'unused_macros',
104+
'unused_variables'
105+
].includes(rd.code.code);
100106
}
101107

102108
/**

0 commit comments

Comments
 (0)