mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 11:20:54 +00:00
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:
parent
d997fd8ea5
commit
5c6ab11453
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user