From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 9F4FC90DB9 for ; Tue, 13 Feb 2024 10:21:36 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 7B86E333CA for ; Tue, 13 Feb 2024 10:21:06 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Tue, 13 Feb 2024 10:21:05 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 8169D47B84 for ; Tue, 13 Feb 2024 10:21:05 +0100 (CET) Date: Tue, 13 Feb 2024 10:20:58 +0100 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox Backup Server development discussion References: <20240212131734.454966-1-m.sandoval@proxmox.com> <20240212131734.454966-8-m.sandoval@proxmox.com> In-Reply-To: <20240212131734.454966-8-m.sandoval@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.16.0 (https://github.com/astroidmail/astroid) Message-Id: <1707815791.z6rg38upnu.astroid@yuna.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-LEVEL: Spam detection results: 1 AWL 0.014 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy FSL_BULK_SIG 0.001 Bulk signature with no Unsubscribe KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RAZOR2_CF_RANGE_51_100 1.886 Razor2 gives confidence level above 50% RAZOR2_CHECK 0.922 Listed in Razor2 (http://razor.sf.net/) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [github.io] URIBL_SBL_A 0.1 Contains URL's A record listed in the Spamhaus SBL blocklist [185.199.110.153, 185.199.111.153, 185.199.108.153, 185.199.109.153] Subject: Re: [pbs-devel] [PATCH backup 08/13] snapshot_reader: use Rc for structs that are not Send+Sync X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2024 09:21:36 -0000 On February 12, 2024 2:17 pm, Maximiliano Sandoval wrote: > Fixes the clippy lint: >=20 > ``` > warning: usage of an `Arc` that is not `Send` and `Sync` > --> pbs-datastore/src/snapshot_reader.rs:156:52 > | > 156 | self.current_index =3D Some((Arc::new(index= ), 0, order)); > | ^^^^^^^^^^^^^^^ > | > =3D note: `Arc>` is not `Send` and `Sync` a= s: > =3D note: - the trait `Sync` is not implemented for `Box` > =3D help: consider using an `Rc` instead. `Arc` does not provide bene= fits for non `Send` and `Sync` types > =3D note: if you intend to use `Arc` with `Send` and `Sync` traits > =3D note: wrap the inner type with a `Mutex` or implement `Send` and = `Sync` for `Box` > =3D help: for further information visit https://rust-lang.github.io/r= ust-clippy/master/index.html#arc_with_non_send_sync > =3D note: `#[warn(clippy::arc_with_non_send_sync)]` on by default > ``` while this fixes the lint, isn't Rc also unneeded here? or am I missing something.. >=20 > Signed-off-by: Maximiliano Sandoval > --- > pbs-datastore/src/snapshot_reader.rs | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) >=20 > diff --git a/pbs-datastore/src/snapshot_reader.rs b/pbs-datastore/src/sna= pshot_reader.rs > index ec7a48e5..816df310 100644 > --- a/pbs-datastore/src/snapshot_reader.rs > +++ b/pbs-datastore/src/snapshot_reader.rs > @@ -1,6 +1,7 @@ > use std::fs::File; > use std::os::unix::io::{AsRawFd, FromRawFd}; > use std::path::Path; > +use std::rc::Rc; > use std::sync::Arc; > =20 > use anyhow::{bail, Error}; > @@ -126,7 +127,7 @@ pub struct SnapshotChunkIterator<'a, F: Fn(&[u8; 32])= -> bool> { > todo_list: Vec, > skip_fn: F, > #[allow(clippy::type_complexity)] > - current_index: Option<(Arc>, usize, Vec<(u= size, u64)>)>, > + current_index: Option<(Rc>, usize, Vec<(us= ize, u64)>)>, > } > =20 > impl<'a, F: Fn(&[u8; 32]) -> bool> Iterator for SnapshotChunkIterator<'a= , F> { > @@ -153,7 +154,7 @@ impl<'a, F: Fn(&[u8; 32]) -> bool> Iterator for Snaps= hotChunkIterator<'a, F> { > let order =3D > datastore.get_chunks_in_order(&*index, &self= .skip_fn, |_| Ok(()))?; > =20 > - self.current_index =3D Some((Arc::new(index), 0,= order)); > + self.current_index =3D Some((Rc::new(index), 0, = order)); > } else { > return Ok(None); > } > --=20 > 2.39.2