From nobody Sat Nov 23 19:19:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1731688972; cv=none; d=zohomail.com; s=zohoarc; b=Kc1dhUKz1rUDns3yNOjn6duuiP7k6DWTwbitnJ0Ah+CDy2zc93I1q+a9a3reyrzD1dj6qCZfk2Y3yWK3Rv0zDNalNDJrNjkwNJJJsiJ17rb6UY3UrMjmbNI643LzJNGPC47uX7VfA+DyKQuv/8PT2NRGgeMdL6jPxLAWHgXsiUI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731688972; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=WSsBp8Ew5NQp7MzYfq8I541wWmJ8ybUUCSw8jpZVemg=; b=XhQuW1RRH+i+wSBY4kwaEdv084zh4SON2AmCRMbPa8zdmjW2IidvksPiCXlFsdhJ3nHYCITeoBkqg1jSspCOZzKr1H4FlEKz1ifj+4gpOjMEz1Mvuv6YdmV7x2bfAlmW0XKjlE6Ak1s12W9MAOwEtV2ic+tcVaEAcKYLDRdnKnE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 173168897228527.60728344673737; Fri, 15 Nov 2024 08:42:52 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBzNt-0006eu-OJ; Fri, 15 Nov 2024 11:41:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tBzNZ-0006No-Sz for qemu-devel@nongnu.org; Fri, 15 Nov 2024 11:41:08 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tBzNY-0002MG-CK for qemu-devel@nongnu.org; Fri, 15 Nov 2024 11:41:05 -0500 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-251-TXtdRpJWOm6cFwpLzoKBaA-1; Fri, 15 Nov 2024 11:41:02 -0500 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-37d4a211177so1055205f8f.0 for ; Fri, 15 Nov 2024 08:41:02 -0800 (PST) Received: from [192.168.10.3] ([151.49.84.243]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3821adbbd82sm4777246f8f.52.2024.11.15.08.40.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Nov 2024 08:40:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731688863; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WSsBp8Ew5NQp7MzYfq8I541wWmJ8ybUUCSw8jpZVemg=; b=Ay+aAyPhaZrwmGz6fwSRFhUWeO1BJZbax7oW6EHDVPyuPEwW0wsJY2ziAZrRLMsXoJYZkl bBsgZpW6FU1e18hva0d7ktuVTXIOwwRBGN+Ge4Cv9JxbSMowGrKyGuhga2DJG0sXMgh/Zm jDCoehebBMp8NI7FBMDwwQsTYaKbEAc= X-MC-Unique: TXtdRpJWOm6cFwpLzoKBaA-1 X-Mimecast-MFC-AGG-ID: TXtdRpJWOm6cFwpLzoKBaA X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731688860; x=1732293660; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WSsBp8Ew5NQp7MzYfq8I541wWmJ8ybUUCSw8jpZVemg=; b=q/wApzbOApqaWvJ8TPkW7BQ83gOlPyw5/szrks8dCKltZvWbB3VTsdVAo2mR1M0LOb tW8zy7I7b6/16tOZAbjFaA8n1kp4quOu18zu0lxQygxhyHulQ9Cz+AC3mDNphhrZ07Eq p9DnjdnoRQluJjcXz2vCV4VOessTt4jzEk2p5k5u0CvmZ3QM1wxRueUkJmLuq6ZK7iHo 4gczIml7+Ff0o6NLNSxfeaYZKu7FcwEV6ol8kv1U2RxYIHkx2+arDef2V3aVYOBiHyiN 6T1jcKC7Wv4uBjXGCZBoKpPrE/NeNMsHTsE+DInFqyA6fIK3MVr/4pQVbbkFCRrnlOAh 1oJQ== X-Gm-Message-State: AOJu0YwkwZpyhdtaPTRRqSsLc/X2s4Y7MCcBKYIwlJd380pTzleqblhh WZ0ZDo9XCuM3Jx7voVy7roBQVcdtByyK2G53ywARS4qngy7CoTDn63nqujsY4jc5Yb0+c8QE256 knnQVXk9frqw3xPC+qDxkF+kn6ZRJKD/rt4wd8jAmia3cbXV04gNZ/RofftBjpDJmLlZNJ8vpZG FM8G9Jjj09u1EM1tgiTREdJE2JeZ3MFEJPsdEvqd0= X-Received: by 2002:a05:6000:491d:b0:371:8319:4dbd with SMTP id ffacd0b85a97d-382259063b5mr2481232f8f.17.1731688859831; Fri, 15 Nov 2024 08:40:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IF9ya/7jEKZ7UNJ/r7lIVCPBSxiM5E7y0IXZZfBCxd2cWZmn85OA/9rCUoRJ7zHpXqAREZEcw== X-Received: by 2002:a05:6000:491d:b0:371:8319:4dbd with SMTP id ffacd0b85a97d-382259063b5mr2481214f8f.17.1731688859379; Fri, 15 Nov 2024 08:40:59 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: qemu-rust@nongnu.org, berrange@redhat.com, junjie.mao@hotmail.com, manos.pitsidianakis@linaro.org, kwolf@redhat.com Subject: [PATCH 08/12] rust: fix a couple style issues from clippy Date: Fri, 15 Nov 2024 17:40:21 +0100 Message-ID: <20241115164025.1917618-8-pbonzini@redhat.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241115163944.1917393-1-pbonzini@redhat.com> References: <20241115163944.1917393-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.12, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.658, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1731688973611116600 Content-Type: text/plain; charset="utf-8" These are reported as clippy::semicolon_inside_block and clippy::as_ptr_cas= t_mut. clippy::semicolon_inside_block can be configured not to lint single-line blocks; just go with the default. Reviewed-by: Junjie Mao Signed-off-by: Paolo Bonzini --- rust/hw/char/pl011/src/device.rs | 8 +++++--- rust/hw/char/pl011/src/memory_ops.rs | 4 +++- rust/qemu-api/tests/tests.rs | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/rust/hw/char/pl011/src/device.rs b/rust/hw/char/pl011/src/devi= ce.rs index 6556865fc22..e582a31e4d3 100644 --- a/rust/hw/char/pl011/src/device.rs +++ b/rust/hw/char/pl011/src/device.rs @@ -2,7 +2,7 @@ // Author(s): Manos Pitsidianakis // SPDX-License-Identifier: GPL-2.0-or-later =20 -use core::ptr::{addr_of, addr_of_mut, NonNull}; +use core::ptr::{addr_of_mut, NonNull}; use std::{ ffi::CStr, os::raw::{c_int, c_uchar, c_uint, c_void}, @@ -499,7 +499,9 @@ pub fn update(&self) { let flags =3D self.int_level & self.int_enabled; for (irq, i) in self.interrupts.iter().zip(IRQMASK) { // SAFETY: self.interrupts have been initialized in init(). - unsafe { qemu_set_irq(*irq, i32::from(flags & i !=3D 0)) }; + unsafe { + qemu_set_irq(*irq, i32::from(flags & i !=3D 0)); + } } } =20 @@ -601,7 +603,7 @@ pub fn post_load(&mut self, _version_id: u32) -> Result= <(), ()> { let sysbus: *mut SysBusDevice =3D dev.cast::(); =20 qdev_prop_set_chr(dev, c_str!("chardev").as_ptr(), chr); - sysbus_realize_and_unref(sysbus, addr_of!(error_fatal) as *mut *mu= t Error); + sysbus_realize_and_unref(sysbus, addr_of_mut!(error_fatal)); sysbus_mmio_map(sysbus, 0, addr); sysbus_connect_irq(sysbus, 0, irq); dev diff --git a/rust/hw/char/pl011/src/memory_ops.rs b/rust/hw/char/pl011/src/= memory_ops.rs index 169d485a4d2..c4e8599ba43 100644 --- a/rust/hw/char/pl011/src/memory_ops.rs +++ b/rust/hw/char/pl011/src/memory_ops.rs @@ -33,7 +33,9 @@ // SAFETY: self.char_backend is a valid CharBackend instance a= fter it's been // initialized in realize(). let cb_ptr =3D unsafe { core::ptr::addr_of_mut!(state.as_mut()= .char_backend) }; - unsafe { qemu_chr_fe_accept_input(cb_ptr) }; + unsafe { + qemu_chr_fe_accept_input(cb_ptr); + } =20 val } diff --git a/rust/qemu-api/tests/tests.rs b/rust/qemu-api/tests/tests.rs index 43a4827de12..925f5a3c77b 100644 --- a/rust/qemu-api/tests/tests.rs +++ b/rust/qemu-api/tests/tests.rs @@ -74,6 +74,6 @@ impl Class for DummyClass { =20 unsafe { module_call_init(module_init_type::MODULE_INIT_QOM); - object_unref(object_new(DummyState::TYPE_NAME.as_ptr()) as *mut _); + object_unref(object_new(DummyState::TYPE_NAME.as_ptr()).cast()); } } --=20 2.47.0