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 C7E73676B0 for ; Tue, 12 Jan 2021 14:58:47 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id C5FE026FE2 for ; Tue, 12 Jan 2021 14:58:47 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (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 id A9A5226FCE for ; Tue, 12 Jan 2021 14:58:46 +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 7602845637 for ; Tue, 12 Jan 2021 14:58:46 +0100 (CET) From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= To: pbs-devel@lists.proxmox.com Date: Tue, 12 Jan 2021 14:58:26 +0100 Message-Id: <20210112135830.2798301-17-f.gruenbichler@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210112135830.2798301-1-f.gruenbichler@proxmox.com> References: <20210112135830.2798301-1-f.gruenbichler@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.026 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [mount.rs, worker-task-abort.rs, proxmox-backup-client.rs, proxmox-backup-proxy.rs] Subject: [pbs-devel] [PATCH proxmox-backup 12/12] cleanup: remove unnecessary 'mut' and '.clone()' 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, 12 Jan 2021 13:58:47 -0000 Signed-off-by: Fabian Grünbichler --- src/bin/proxmox-backup-client.rs | 2 +- src/bin/proxmox-backup-proxy.rs | 2 +- src/bin/proxmox_backup_client/mount.rs | 2 +- src/client/backup_writer.rs | 5 +---- src/server/command_socket.rs | 2 +- src/tools/async_channel_writer.rs | 2 +- src/tools/broadcast_future.rs | 2 +- tests/worker-task-abort.rs | 2 +- 8 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/bin/proxmox-backup-client.rs b/src/bin/proxmox-backup-client.rs index d91f04cc..2cd00c2e 100644 --- a/src/bin/proxmox-backup-client.rs +++ b/src/bin/proxmox-backup-client.rs @@ -305,7 +305,7 @@ async fn backup_directory>( )?; let mut chunk_stream = ChunkStream::new(pxar_stream, chunk_size); - let (mut tx, rx) = mpsc::channel(10); // allow to buffer 10 chunks + let (tx, rx) = mpsc::channel(10); // allow to buffer 10 chunks let stream = ReceiverStream::new(rx) .map_err(Error::from); diff --git a/src/bin/proxmox-backup-proxy.rs b/src/bin/proxmox-backup-proxy.rs index c8eb237c..39e8d537 100644 --- a/src/bin/proxmox-backup-proxy.rs +++ b/src/bin/proxmox-backup-proxy.rs @@ -164,7 +164,7 @@ async fn run() -> Result<(), Error> { } fn accept_connections( - mut listener: tokio::net::TcpListener, + listener: tokio::net::TcpListener, acceptor: Arc, debug: bool, ) -> tokio::sync::mpsc::Receiver>>, Error>> { diff --git a/src/bin/proxmox_backup_client/mount.rs b/src/bin/proxmox_backup_client/mount.rs index 204ed7fc..f8410709 100644 --- a/src/bin/proxmox_backup_client/mount.rs +++ b/src/bin/proxmox_backup_client/mount.rs @@ -294,7 +294,7 @@ async fn mount_do(param: Value, pipe: Option) -> Result { // poll until loop file is mapped (or errors) select! { - res = session_fut => { + _res = session_fut => { bail!("FUSE session unexpectedly ended before loop file mapping"); }, res = st_recv.try_next() => { diff --git a/src/client/backup_writer.rs b/src/client/backup_writer.rs index bcbd6f28..e7a6d6bd 100644 --- a/src/client/backup_writer.rs +++ b/src/client/backup_writer.rs @@ -583,6 +583,7 @@ impl BackupWriter { }) .merge_known_chunks() .try_for_each(move |merged_chunk_info| { + let upload_queue = upload_queue.clone(); if let MergedChunkInfo::New(chunk_info) = merged_chunk_info { let offset = chunk_info.offset; @@ -610,7 +611,6 @@ impl BackupWriter { let new_info = MergedChunkInfo::Known(vec![(offset, digest)]); - let mut upload_queue = upload_queue.clone(); future::Either::Left(h2 .send_request(request, upload_data) .and_then(move |response| async move { @@ -621,7 +621,6 @@ impl BackupWriter { }) ) } else { - let mut upload_queue = upload_queue.clone(); future::Either::Right(async move { upload_queue .send((merged_chunk_info, None)) @@ -673,8 +672,6 @@ impl BackupWriter { break; } - let mut upload_queue = upload_queue.clone(); - if verbose { eprintln!("send test data ({} bytes)", data.len()); } let request = H2Client::request_builder("localhost", "POST", "speedtest", None, None).unwrap(); let request_future = self.h2.send_request(request, Some(bytes::Bytes::from(data.clone()))).await?; diff --git a/src/server/command_socket.rs b/src/server/command_socket.rs index 08e59173..84d4e9fe 100644 --- a/src/server/command_socket.rs +++ b/src/server/command_socket.rs @@ -21,7 +21,7 @@ where let backup_user = crate::backup::backup_user()?; let backup_gid = backup_user.gid.as_raw(); - let mut socket = UnixListener::bind(&path)?; + let socket = UnixListener::bind(&path)?; let func = Arc::new(func); diff --git a/src/tools/async_channel_writer.rs b/src/tools/async_channel_writer.rs index 4bb56ac5..f48bd555 100644 --- a/src/tools/async_channel_writer.rs +++ b/src/tools/async_channel_writer.rs @@ -58,7 +58,7 @@ impl AsyncChannelWriter { } } - let mut sender = match self.sender.take() { + let sender = match self.sender.take() { Some(sender) => sender, None => return Poll::Ready(Err(io_err_other("no sender"))), }; diff --git a/src/tools/broadcast_future.rs b/src/tools/broadcast_future.rs index 1c82bdc3..3c96d2dc 100644 --- a/src/tools/broadcast_future.rs +++ b/src/tools/broadcast_future.rs @@ -159,7 +159,7 @@ fn test_broadcast_future() { .map_err(|err| { panic!("got error {}", err); }) .map(|_| ()); - let mut rt = tokio::runtime::Runtime::new().unwrap(); + let rt = tokio::runtime::Runtime::new().unwrap(); rt.block_on(async move { let r1 = tokio::spawn(receiver1); let r2 = tokio::spawn(receiver2); diff --git a/tests/worker-task-abort.rs b/tests/worker-task-abort.rs index 5b73c8b9..7ec3958c 100644 --- a/tests/worker-task-abort.rs +++ b/tests/worker-task-abort.rs @@ -39,7 +39,7 @@ fn worker_task_abort() -> Result<(), Error> { let errmsg: Arc>> = Arc::new(Mutex::new(None)); let errmsg1 = errmsg.clone(); - let mut rt = tokio::runtime::Runtime::new().unwrap(); + let rt = tokio::runtime::Runtime::new().unwrap(); rt.block_on(async move { let mut commando_sock = server::CommandoSocket::new(server::our_ctrl_sock()); -- 2.20.1