qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [PATCH 4/3] rust: use native Meson support for clippy and rustdoc
Date: Sat,  5 Apr 2025 14:23:41 +0200	[thread overview]
Message-ID: <20250405122341.264763-1-pbonzini@redhat.com> (raw)
In-Reply-To: <20250405100603.253421-1-pbonzini@redhat.com>

Meson has support for invoking clippy and rustdoc on all crates
(1.7.0 for clippy, 1.8.0 for rustdoc).  Use it instead of the
homegrown version.

rustfmt is still not supported.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build                     |  2 +-
 rust/clippy.toml => clippy.toml |  0
 rust/Cargo.toml                 |  1 -
 rust/meson.build                | 12 ------------
 scripts/rust/rustc_args.py      |  5 +----
 5 files changed, 2 insertions(+), 18 deletions(-)
 rename rust/clippy.toml => clippy.toml (100%)

diff --git a/meson.build b/meson.build
index ce4c947e956..d4a868c5188 100644
--- a/meson.build
+++ b/meson.build
@@ -4241,7 +4241,7 @@ foreach target : target_dirs
                               build_by_default: true,
                               build_always_stale: true)
       rlib = static_library('rust_' + target.underscorify(),
-                            rlib_rs,
+                            structured_sources([], {'.': rlib_rs}),
                             dependencies: target_rust.dependencies(),
                             override_options: ['rust_std=2021', 'build.rust_std=2021'],
                             rust_abi: 'c')
diff --git a/rust/clippy.toml b/clippy.toml
similarity index 100%
rename from rust/clippy.toml
rename to clippy.toml
diff --git a/rust/Cargo.toml b/rust/Cargo.toml
index ab1185a8143..38870f06c11 100644
--- a/rust/Cargo.toml
+++ b/rust/Cargo.toml
@@ -56,7 +56,6 @@ ignored_unit_patterns = "deny"
 implicit_clone = "deny"
 macro_use_imports = "deny"
 missing_safety_doc = "deny"
-multiple_crate_versions = "deny"
 mut_mut = "deny"
 needless_bitwise_bool = "deny"
 needless_pass_by_ref_mut = "deny"
diff --git a/rust/meson.build b/rust/meson.build
index 91e52b8fb8e..9736ad300bb 100644
--- a/rust/meson.build
+++ b/rust/meson.build
@@ -6,21 +6,9 @@ subdir('hw')
 cargo = find_program('cargo', required: false)
 
 if cargo.found()
-  run_target('clippy',
-    command: [config_host['MESON'], 'devenv',
-              '--workdir', '@CURRENT_SOURCE_DIR@',
-              cargo, 'clippy', '--tests'],
-    depends: bindings_rs)
-
   run_target('rustfmt',
     command: [config_host['MESON'], 'devenv',
               '--workdir', '@CURRENT_SOURCE_DIR@',
               cargo, 'fmt'],
     depends: bindings_rs)
-
-  run_target('rustdoc',
-    command: [config_host['MESON'], 'devenv',
-              '--workdir', '@CURRENT_SOURCE_DIR@',
-              cargo, 'doc', '--no-deps', '--document-private-items'],
-    depends: bindings_rs)
 endif
diff --git a/scripts/rust/rustc_args.py b/scripts/rust/rustc_args.py
index 2633157df2a..63b0748e0d3 100644
--- a/scripts/rust/rustc_args.py
+++ b/scripts/rust/rustc_args.py
@@ -104,10 +104,7 @@ def generate_lint_flags(cargo_toml: CargoTOML, strict_lints: bool) -> Iterable[s
             else:
                 raise Exception(f"invalid level {level} for {prefix}{lint}")
 
-            # This may change if QEMU ever invokes clippy-driver or rustdoc by
-            # hand.  For now, check the syntax but do not add non-rustc lints to
-            # the command line.
-            if k == "rust" and not (strict_lints and lint in STRICT_LINTS):
+            if not (strict_lints and lint in STRICT_LINTS):
                 lint_list.append(LintFlag(flags=[flag, prefix + lint], priority=priority))
 
     if strict_lints:
-- 
2.49.0



  parent reply	other threads:[~2025-04-05 12:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-05 10:06 [PATCH preview 0/3] rust: update build system for Meson 1.8.0 Paolo Bonzini
2025-04-05 10:06 ` [PATCH 1/3] rust: use "objects" for Rust executables as well Paolo Bonzini
2025-04-05 10:06 ` [PATCH 2/3] rust: add qemu-api doctests to "meson test" Paolo Bonzini
2025-04-05 10:06 ` [PATCH 3/3] rust: cell: remove support for running doctests with "cargo test --doc" Paolo Bonzini
2025-04-05 12:23 ` Paolo Bonzini [this message]
2025-04-07  7:37 ` [PATCH preview 0/3] rust: update build system for Meson 1.8.0 Zhao Liu
2025-04-07  7:51   ` Paolo Bonzini
2025-04-08 20:34 ` Bernhard Beschow
2025-04-08 21:08   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250405122341.264763-1-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).