* [PATCH 0/2] rust: small cleanups to Cargo.toml files
@ 2025-01-29 8:37 Paolo Bonzini
2025-01-29 8:37 ` [PATCH 1/2] rust: remove unnecessary Cargo.toml metadata Paolo Bonzini
2025-01-29 8:37 ` [PATCH 2/2] rust: include rust_version in Cargo.toml Paolo Bonzini
0 siblings, 2 replies; 6+ messages in thread
From: Paolo Bonzini @ 2025-01-29 8:37 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-rust
Remove duplicate or stale information, and add the rustc version to
help clippy produce good warnings.
Paolo
Paolo Bonzini (2):
rust: remove unnecessary Cargo.toml metadata
rust: include rust_version in Cargo.toml
rust/hw/char/pl011/Cargo.toml | 4 +---
rust/hw/char/pl011/README.md | 31 --------------------------
rust/hw/char/pl011/src/device_class.rs | 1 -
rust/hw/char/pl011/src/lib.rs | 14 +++++-------
rust/qemu-api-macros/Cargo.toml | 4 +---
rust/qemu-api-macros/README.md | 1 -
rust/qemu-api/Cargo.toml | 1 +
7 files changed, 9 insertions(+), 47 deletions(-)
delete mode 100644 rust/hw/char/pl011/README.md
delete mode 100644 rust/qemu-api-macros/README.md
--
2.48.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] rust: remove unnecessary Cargo.toml metadata
2025-01-29 8:37 [PATCH 0/2] rust: small cleanups to Cargo.toml files Paolo Bonzini
@ 2025-01-29 8:37 ` Paolo Bonzini
2025-02-06 10:42 ` Zhao Liu
2025-01-29 8:37 ` [PATCH 2/2] rust: include rust_version in Cargo.toml Paolo Bonzini
1 sibling, 1 reply; 6+ messages in thread
From: Paolo Bonzini @ 2025-01-29 8:37 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-rust
Some items of Cargo.toml (readme, homepage, repository) are
only present because of clippy::cargo warnings being enabled in
rust/hw/char/pl011/src/lib.rs. But these items are not
particularly useful and would be all the same for all Cargo.toml
files in the QEMU workspace. Clean them up.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
rust/hw/char/pl011/Cargo.toml | 3 ---
rust/hw/char/pl011/README.md | 31 -------------------------------
rust/hw/char/pl011/src/lib.rs | 14 ++++++--------
rust/qemu-api-macros/Cargo.toml | 3 ---
rust/qemu-api-macros/README.md | 1 -
5 files changed, 6 insertions(+), 46 deletions(-)
delete mode 100644 rust/hw/char/pl011/README.md
delete mode 100644 rust/qemu-api-macros/README.md
diff --git a/rust/hw/char/pl011/Cargo.toml b/rust/hw/char/pl011/Cargo.toml
index 58f3e859f7e..2b4097864df 100644
--- a/rust/hw/char/pl011/Cargo.toml
+++ b/rust/hw/char/pl011/Cargo.toml
@@ -4,10 +4,7 @@ version = "0.1.0"
edition = "2021"
authors = ["Manos Pitsidianakis <manos.pitsidianakis@linaro.org>"]
license = "GPL-2.0-or-later"
-readme = "README.md"
-homepage = "https://www.qemu.org"
description = "pl011 device model for QEMU"
-repository = "https://gitlab.com/epilys/rust-for-qemu"
resolver = "2"
publish = false
keywords = []
diff --git a/rust/hw/char/pl011/README.md b/rust/hw/char/pl011/README.md
deleted file mode 100644
index cd7dea31634..00000000000
--- a/rust/hw/char/pl011/README.md
+++ /dev/null
@@ -1,31 +0,0 @@
-# PL011 QEMU Device Model
-
-This library implements a device model for the PrimeCell® UART (PL011)
-device in QEMU.
-
-## Build static lib
-
-Host build target must be explicitly specified:
-
-```sh
-cargo build --target x86_64-unknown-linux-gnu
-```
-
-Replace host target triplet if necessary.
-
-## Generate Rust documentation
-
-To generate docs for this crate, including private items:
-
-```sh
-cargo doc --no-deps --document-private-items --target x86_64-unknown-linux-gnu
-```
-
-To include direct dependencies like `bilge` (bitmaps for register types):
-
-```sh
-cargo tree --depth 1 -e normal --prefix none \
- | cut -d' ' -f1 \
- | xargs printf -- '-p %s\n' \
- | xargs cargo doc --no-deps --document-private-items --target x86_64-unknown-linux-gnu
-```
diff --git a/rust/hw/char/pl011/src/lib.rs b/rust/hw/char/pl011/src/lib.rs
index e2df4586bcc..e704daf6e3e 100644
--- a/rust/hw/char/pl011/src/lib.rs
+++ b/rust/hw/char/pl011/src/lib.rs
@@ -1,13 +1,12 @@
// Copyright 2024, Linaro Limited
// Author(s): Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
// SPDX-License-Identifier: GPL-2.0-or-later
-//
-// PL011 QEMU Device Model
-//
-// This library implements a device model for the PrimeCell® UART (PL011)
-// device in QEMU.
-//
-#![doc = include_str!("../README.md")]
+
+//! PL011 QEMU Device Model
+//!
+//! This library implements a device model for the PrimeCell® UART (PL011)
+//! device in QEMU.
+//!
//! # Library crate
//!
//! See [`PL011State`](crate::device::PL011State) for the device model type and
@@ -18,7 +17,6 @@
clippy::suspicious,
clippy::complexity,
clippy::perf,
- clippy::cargo,
clippy::nursery,
clippy::style
)]
diff --git a/rust/qemu-api-macros/Cargo.toml b/rust/qemu-api-macros/Cargo.toml
index 5a27b52ee6e..b9b4baecddb 100644
--- a/rust/qemu-api-macros/Cargo.toml
+++ b/rust/qemu-api-macros/Cargo.toml
@@ -4,10 +4,7 @@ version = "0.1.0"
edition = "2021"
authors = ["Manos Pitsidianakis <manos.pitsidianakis@linaro.org>"]
license = "GPL-2.0-or-later"
-readme = "README.md"
-homepage = "https://www.qemu.org"
description = "Rust bindings for QEMU - Utility macros"
-repository = "https://gitlab.com/qemu-project/qemu/"
resolver = "2"
publish = false
keywords = []
diff --git a/rust/qemu-api-macros/README.md b/rust/qemu-api-macros/README.md
deleted file mode 100644
index f60f54ac4be..00000000000
--- a/rust/qemu-api-macros/README.md
+++ /dev/null
@@ -1 +0,0 @@
-# `qemu-api-macros` - Utility macros for defining QEMU devices
--
2.48.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] rust: include rust_version in Cargo.toml
2025-01-29 8:37 [PATCH 0/2] rust: small cleanups to Cargo.toml files Paolo Bonzini
2025-01-29 8:37 ` [PATCH 1/2] rust: remove unnecessary Cargo.toml metadata Paolo Bonzini
@ 2025-01-29 8:37 ` Paolo Bonzini
2025-02-06 11:02 ` Zhao Liu
1 sibling, 1 reply; 6+ messages in thread
From: Paolo Bonzini @ 2025-01-29 8:37 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-rust
Tell clippy the minimum supported Rust version for QEMU.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
rust/hw/char/pl011/Cargo.toml | 1 +
rust/hw/char/pl011/src/device_class.rs | 1 -
rust/qemu-api-macros/Cargo.toml | 1 +
rust/qemu-api/Cargo.toml | 1 +
4 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/rust/hw/char/pl011/Cargo.toml b/rust/hw/char/pl011/Cargo.toml
index 2b4097864df..f2296cad58b 100644
--- a/rust/hw/char/pl011/Cargo.toml
+++ b/rust/hw/char/pl011/Cargo.toml
@@ -9,6 +9,7 @@ resolver = "2"
publish = false
keywords = []
categories = []
+rust-version = "1.63.0"
[lib]
crate-type = ["staticlib"]
diff --git a/rust/hw/char/pl011/src/device_class.rs b/rust/hw/char/pl011/src/device_class.rs
index 8a157a663fb..dbef93f6cb3 100644
--- a/rust/hw/char/pl011/src/device_class.rs
+++ b/rust/hw/char/pl011/src/device_class.rs
@@ -12,7 +12,6 @@
use crate::device::{PL011Registers, PL011State};
-#[allow(clippy::missing_const_for_fn)]
extern "C" fn pl011_clock_needed(opaque: *mut c_void) -> bool {
let state = NonNull::new(opaque).unwrap().cast::<PL011State>();
unsafe { state.as_ref().migrate_clock }
diff --git a/rust/qemu-api-macros/Cargo.toml b/rust/qemu-api-macros/Cargo.toml
index b9b4baecddb..89dee1cfb39 100644
--- a/rust/qemu-api-macros/Cargo.toml
+++ b/rust/qemu-api-macros/Cargo.toml
@@ -9,6 +9,7 @@ resolver = "2"
publish = false
keywords = []
categories = []
+rust-version = "1.63.0"
[lib]
proc-macro = true
diff --git a/rust/qemu-api/Cargo.toml b/rust/qemu-api/Cargo.toml
index 4aa22f31986..a51dd142852 100644
--- a/rust/qemu-api/Cargo.toml
+++ b/rust/qemu-api/Cargo.toml
@@ -12,6 +12,7 @@ resolver = "2"
publish = false
keywords = []
categories = []
+rust-version = "1.63.0"
[dependencies]
qemu_api_macros = { path = "../qemu-api-macros" }
--
2.48.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] rust: remove unnecessary Cargo.toml metadata
2025-01-29 8:37 ` [PATCH 1/2] rust: remove unnecessary Cargo.toml metadata Paolo Bonzini
@ 2025-02-06 10:42 ` Zhao Liu
0 siblings, 0 replies; 6+ messages in thread
From: Zhao Liu @ 2025-02-06 10:42 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel, qemu-rust
On Wed, Jan 29, 2025 at 09:37:03AM +0100, Paolo Bonzini wrote:
> Date: Wed, 29 Jan 2025 09:37:03 +0100
> From: Paolo Bonzini <pbonzini@redhat.com>
> Subject: [PATCH 1/2] rust: remove unnecessary Cargo.toml metadata
> X-Mailer: git-send-email 2.48.1
>
> Some items of Cargo.toml (readme, homepage, repository) are
> only present because of clippy::cargo warnings being enabled in
> rust/hw/char/pl011/src/lib.rs. But these items are not
> particularly useful and would be all the same for all Cargo.toml
> files in the QEMU workspace. Clean them up.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> rust/hw/char/pl011/Cargo.toml | 3 ---
> rust/hw/char/pl011/README.md | 31 -------------------------------
> rust/hw/char/pl011/src/lib.rs | 14 ++++++--------
> rust/qemu-api-macros/Cargo.toml | 3 ---
> rust/qemu-api-macros/README.md | 1 -
> 5 files changed, 6 insertions(+), 46 deletions(-)
> delete mode 100644 rust/hw/char/pl011/README.md
> delete mode 100644 rust/qemu-api-macros/README.md
>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] rust: include rust_version in Cargo.toml
2025-01-29 8:37 ` [PATCH 2/2] rust: include rust_version in Cargo.toml Paolo Bonzini
@ 2025-02-06 11:02 ` Zhao Liu
2025-02-06 22:31 ` Paolo Bonzini
0 siblings, 1 reply; 6+ messages in thread
From: Zhao Liu @ 2025-02-06 11:02 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel, qemu-rust
> diff --git a/rust/hw/char/pl011/src/device_class.rs b/rust/hw/char/pl011/src/device_class.rs
> index 8a157a663fb..dbef93f6cb3 100644
> --- a/rust/hw/char/pl011/src/device_class.rs
> +++ b/rust/hw/char/pl011/src/device_class.rs
> @@ -12,7 +12,6 @@
>
> use crate::device::{PL011Registers, PL011State};
>
> -#[allow(clippy::missing_const_for_fn)]
It seems like a rebase nit since the commit 7d0520398f7f ("rust: prefer
NonNull::new to assertions"), which is not worth an extra commit either.
> extern "C" fn pl011_clock_needed(opaque: *mut c_void) -> bool {
> let state = NonNull::new(opaque).unwrap().cast::<PL011State>();
> unsafe { state.as_ref().migrate_clock }
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] rust: include rust_version in Cargo.toml
2025-02-06 11:02 ` Zhao Liu
@ 2025-02-06 22:31 ` Paolo Bonzini
0 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2025-02-06 22:31 UTC (permalink / raw)
To: Zhao Liu; +Cc: qemu-devel, qemu-rust
[-- Attachment #1: Type: text/plain, Size: 973 bytes --]
Il gio 6 feb 2025, 11:42 Zhao Liu <zhao1.liu@intel.com> ha scritto:
> > diff --git a/rust/hw/char/pl011/src/device_class.rs
> b/rust/hw/char/pl011/src/device_class.rs
> > index 8a157a663fb..dbef93f6cb3 100644
> > --- a/rust/hw/char/pl011/src/device_class.rs
> > +++ b/rust/hw/char/pl011/src/device_class.rs
> > @@ -12,7 +12,6 @@
> >
> > use crate::device::{PL011Registers, PL011State};
> >
> > -#[allow(clippy::missing_const_for_fn)]
>
> It seems like a rebase nit since the commit 7d0520398f7f ("rust: prefer
> NonNull::new to assertions"), which is not worth an extra commit either.
>
It's not; adding rust_version let's Clippy know that this function cannot
be const in all supported versions of the standard library.
Paolo
> extern "C" fn pl011_clock_needed(opaque: *mut c_void) -> bool {
> > let state = NonNull::new(opaque).unwrap().cast::<PL011State>();
> > unsafe { state.as_ref().migrate_clock }
>
> Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
>
>
[-- Attachment #2: Type: text/html, Size: 2162 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-02-06 22:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-29 8:37 [PATCH 0/2] rust: small cleanups to Cargo.toml files Paolo Bonzini
2025-01-29 8:37 ` [PATCH 1/2] rust: remove unnecessary Cargo.toml metadata Paolo Bonzini
2025-02-06 10:42 ` Zhao Liu
2025-01-29 8:37 ` [PATCH 2/2] rust: include rust_version in Cargo.toml Paolo Bonzini
2025-02-06 11:02 ` Zhao Liu
2025-02-06 22:31 ` Paolo Bonzini
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).