docs/rust/dev_experience_tips_and_tricks.md
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",
}
}
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 Clippy warnings (as well as C/C++ warnings).Rust Style Guide allows up to 100-characters-wide lines (just like Java). If Gerrit is configured for 80-characters-wide lines, it can lead to a suboptimal user experience. This can be resolved by changing Gerrit settings (e.g. at https://chromium-review.googlesource.com/settings) as follows: