Rust-analyzer simply emits a weak warning with the unused flag set: rust-analyzer/inactive_code.rs at 38e9a110d4f136c22cb4eed9c3581d7992eade56 · rust-lang/rust-analyzer · GitHub. How that is shown to the user is up to the editor. Rust-analyzer doesn't have control over this. Maybe vscode-cpptools directly uses vscode api's to style the code instead of emitting diagnostics with the unused flag? That doesn't work with other editors and requires code in the vscode extension as opposed to the language server itself.