qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Junjie Mao <junjie.mao@hotmail.com>
Cc: qemu-devel@nongnu.org, manos.pitsidianakis@linaro.org,
	kwolf@redhat.com, zhao1.liu@intel.com, qemu-rust@nondevel.org
Subject: Re: [RFC PATCH 08/11] rust: build: establish a baseline of lints across all crates
Date: Wed, 13 Nov 2024 11:02:53 +0100	[thread overview]
Message-ID: <6e0f3ee4-0e79-4d26-8ffc-10c893ee8614@redhat.com> (raw)
In-Reply-To: <ME0P300MB1040EF4DBFD69EC355D1A708955A2@ME0P300MB1040.AUSP300.PROD.OUTLOOK.COM>

On 11/13/24 08:14, Junjie Mao wrote:
> 
> Paolo Bonzini <pbonzini@redhat.com> writes:
> 
>> Many lints that default to allow can be helpful in detecting bugs or
>> keeping the code style homogeneous.  Add them liberally, though perhaps
>> not as liberally as in hw/char/pl011/src/lib.rs.  In particular, enabling
>> entire groups can be problematic because of bitrot when new links are
>> added in the future.
>>
>> For Clippy, this is actually a feature that is only present in Cargo
>> 1.74.0 but, since we are not using Cargo to *build* QEMU, only developers
>> will need a new-enough cargo and only to run tools such as clippy.
>> The requirement does not apply to distros that are building QEMU.
>>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>>   rust/Cargo.toml               | 66 +++++++++++++++++++++++++++++++++++
>>   rust/hw/char/pl011/src/lib.rs | 18 ++--------
>>   rust/qemu-api/src/bindings.rs |  6 ++--
>>   3 files changed, 71 insertions(+), 19 deletions(-)
>>
>> diff --git a/rust/Cargo.toml b/rust/Cargo.toml
>> index 1ff8f5c2781..43cca33a8d8 100644
>> --- a/rust/Cargo.toml
>> +++ b/rust/Cargo.toml
>> @@ -19,3 +19,69 @@ unknown_lints = "allow"
>>
>>   # Prohibit code that is forbidden in Rust 2024
>>   unsafe_op_in_unsafe_fn = "deny"
>> +
> [snip]
>> +
>> +# nice to have, but cannot be enabled yet
>> +#wildcard_imports = "deny"
>> +
>> +# these may have false positives
>> +#option_if_let_else = "deny"
>> +cognitive_complexity = "deny"
> 
> Just to confirm, CC <= 25 is to be enforced for all methods, right?

I wanted an opinion on that.  option_if_let_else has been more of a pain 
than a benefit, sometimes it suggests code that is worse or does not 
even compile.

So far I've never had any cognitive_complexity error show up, but pl011 
used it so I have kept it in Cargo.toml.  If we start having too many 
#[allow()] for cognitive_complexity we can remove it; for many of the 
others, instead, we might even change deny to forbid.

Paolo



  reply	other threads:[~2024-11-13 10:04 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-08 18:01 [RFC PATCH 00/11] rust: improved integration with cargo Paolo Bonzini
2024-11-08 18:01 ` [RFC PATCH 01/11] rust: qemu_api: do not disable lints outside bindgen-generated code Paolo Bonzini
2024-11-12  2:25   ` Junjie Mao
2024-11-12  5:33     ` Paolo Bonzini
2024-11-12 10:10       ` Junjie Mao
2024-11-12 18:47         ` Paolo Bonzini
2024-11-13  6:46           ` Junjie Mao
2024-11-13 10:41             ` Paolo Bonzini
2024-11-08 18:01 ` [RFC PATCH 02/11] rust: build: move rustc_args.py invocation to individual crates Paolo Bonzini
2024-11-12  3:02   ` Junjie Mao
2024-11-08 18:01 ` [RFC PATCH 03/11] rust: build: restrict --cfg generation to only required symbols Paolo Bonzini
2024-11-08 18:01 ` [RFC PATCH 04/11] rust: build: generate warning flags from Cargo.toml Paolo Bonzini
2024-11-08 18:01 ` [RFC PATCH 05/11] rust: cargo: store desired warning levels in workspace Cargo.toml Paolo Bonzini
2024-11-12  3:12   ` Junjie Mao
2024-11-12  5:28     ` Paolo Bonzini
2024-11-12  5:40       ` Junjie Mao
2024-11-08 18:01 ` [RFC PATCH 06/11] rust: build: move strict lints handling to rustc_args.py Paolo Bonzini
2024-11-08 18:01 ` [RFC PATCH 07/11] rust: fix a couple style issues from clippy Paolo Bonzini
2024-11-13  6:59   ` Junjie Mao
2024-11-08 18:01 ` [RFC PATCH 08/11] rust: build: establish a baseline of lints across all crates Paolo Bonzini
2024-11-13  7:14   ` Junjie Mao
2024-11-13 10:02     ` Paolo Bonzini [this message]
2024-11-13 10:13       ` Junjie Mao
2024-11-08 18:01 ` [RFC PATCH 09/11] rust: build: add "make clippy", "make rustfmt" Paolo Bonzini
2024-11-13  7:20   ` Junjie Mao
2024-11-08 18:01 ` [RFC PATCH 10/11] rust: fix doc test syntax Paolo Bonzini
2024-11-13  7:22   ` Junjie Mao
2024-11-08 18:01 ` [RFC PATCH 11/11] rust: ci: add job that runs Rust tools Paolo Bonzini
2024-11-08 18:12   ` Daniel P. Berrangé
2024-11-14 13:07 ` [RFC PATCH 00/11] rust: improved integration with cargo Alex Bennée
2024-11-14 13:11   ` Paolo Bonzini
2024-11-14 15:22     ` Alex Bennée
2024-11-14 15:38       ` Paolo Bonzini
2024-11-14 17:27         ` Alex Bennée
2024-11-14 18:18           ` Paolo Bonzini
2024-11-14 21:13             ` Alex Bennée

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=6e0f3ee4-0e79-4d26-8ffc-10c893ee8614@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=junjie.mao@hotmail.com \
    --cc=kwolf@redhat.com \
    --cc=manos.pitsidianakis@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-rust@nondevel.org \
    --cc=zhao1.liu@intel.com \
    /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).