From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 372E41FF2A7 for ; Mon, 1 Jul 2024 13:23:17 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 3E14B344DA; Mon, 1 Jul 2024 13:23:32 +0200 (CEST) Date: Mon, 01 Jul 2024 13:22:54 +0200 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox Backup Server development discussion References: <20240312100926.62899-1-c.ebner@proxmox.com> In-Reply-To: <20240312100926.62899-1-c.ebner@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.16.0 (https://github.com/astroidmail/astroid) Message-Id: <1719832960.zmdqlhmssn.astroid@yuna.none> X-SPAM-LEVEL: Spam detection results: 0 AWL 0.051 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 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pbs-devel] [PATCH proxmox-backup] encoder: merge create_file and create_file_do 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: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" doesn't apply anymore, if this should still be done, please rebase+resend! On March 12, 2024 11:09 am, Christian Ebner wrote: > `create_file` only transforms the path to bytes before calling > `create_file_do` with it. Since this is the only caller and the latter > method is private, this can be merged into one method to reduce code. > > Suggested-by: Dietmar Maurer > Signed-off-by: Christian Ebner > --- > src/encoder/mod.rs | 15 ++------------- > 1 file changed, 2 insertions(+), 13 deletions(-) > > diff --git a/src/encoder/mod.rs b/src/encoder/mod.rs > index 0d342ec..21eb78a 100644 > --- a/src/encoder/mod.rs > +++ b/src/encoder/mod.rs > @@ -340,25 +340,14 @@ impl<'a, T: SeqWrite + 'a> EncoderImpl<'a, T> { > file_name: &Path, > file_size: u64, > ) -> io::Result> > - where > - 'a: 'b, > - { > - self.create_file_do(metadata, file_name.as_os_str().as_bytes(), file_size) > - .await > - } > - > - async fn create_file_do<'b>( > - &'b mut self, > - metadata: &Metadata, > - file_name: &[u8], > - file_size: u64, > - ) -> io::Result> > where > 'a: 'b, > { > self.check()?; > > let file_offset = self.position(); > + let file_name = file_name.as_os_str().as_bytes(); > + > self.start_file_do(Some(metadata), file_name).await?; > > let header = format::Header::with_content_size(format::PXAR_PAYLOAD, file_size); > -- > 2.39.2 > > > > _______________________________________________ > pbs-devel mailing list > pbs-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel > > > _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel