mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 18:23:57 -06:00
rust: cargo: store desired warning levels in workspace Cargo.toml
An extra benefit of workspaces is that they allow to place lint level settings in a single Cargo.toml; the settings are then inherited by packages in the workspace. Correspondingly, teach rustc_args.py to get the unexpected_cfgs configuration from the workspace Cargo.toml. Note that it is still possible to allow or deny warnings per crate or module, via the #![] attribute syntax. The rust/qemu-api/src/bindings.rs file is an example. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
97ed1e9c8e
commit
90868c3dce
7 changed files with 53 additions and 13 deletions
|
@ -121,11 +121,12 @@ endif
|
|||
|
||||
if have_rust
|
||||
rustc_args = [find_program('scripts/rust/rustc_args.py'),
|
||||
'--rustc-version', rustc.version()]
|
||||
'--rustc-version', rustc.version(),
|
||||
'--workspace', meson.project_source_root() / 'rust']
|
||||
rustfmt = find_program('rustfmt', required: false)
|
||||
|
||||
# Prohibit code that is forbidden in Rust 2024
|
||||
rustc_lint_args = ['-D', 'unsafe_op_in_unsafe_fn']
|
||||
rustc_lint_args = run_command(rustc_args, '--lints',
|
||||
capture: true, check: true).stdout().strip().splitlines()
|
||||
|
||||
# Occasionally, we may need to silence warnings and clippy lints that
|
||||
# were only introduced in newer Rust compiler versions. Do not croak
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue