rust-analyzer extension for VSCode, rather than earlier forms of Rust support.gn with the --export-rust-project flag, such as: gn gen out/Release --export-rust-project.ln -s out/Release/rust-project.json rust-project.jsonrust-project.json and use this to give you rich browsing, autocompletion, type annotations etc. for all the Rust within the Chromium codebase..vscode/settings.json in the Chromium checkout (e.g. chromium/src/.vscode/settings.json; create the subdirectory and file if they do not already exist):{
// The rest of the settings...
"rust-analyzer.cargo.extraEnv": {
"PATH": "../../third_party/rust-toolchain/bin:$PATH",
}
}
This assumes you are working with an output directory like out/Debug which has two levels; adjust the number of .. in the path according to your own setup.We don't want to commit Rust code with unused variables, but work-in-progress changes often temporarily have unused code. The following options exist for dealing with unused code warnings:
_foo rather than foo as the name).#[!allow(unused)] /* DO NOT SUBMIT */ at the top of the affected .rs files.rustc -W help for a list of warnings covered by the unused group of warnings.#![warn(...)] to still see the warnings, but avoid treating them as errors.treat_warnings_as_errors = false in your args.gn. This will affect all Rust and C/C++ warnings.