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.
This commit is contained in:
Ryan Cumming 2019-06-25 21:44:27 +10:00
parent d997fd8ea5
commit 5c6ab11453

View File

@ -95,8 +95,14 @@ function isUnusedOrUnnecessary(rd: RustDiagnostic): boolean {
return false;
}
const { code } = rd.code;
return code.startsWith('unused_') || code === 'dead_code';
return [
'dead_code',
'unknown_lints',
'unused_attributes',
'unused_imports',
'unused_macros',
'unused_variables'
].includes(rd.code.code);
}
/**