mirror of
https://git.proxmox.com/git/proxmox
synced 2025-10-04 11:59:37 +00:00
compression: style changes
use where clauses where the parameter list is short enough to become a single line easier to read Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
d4a09de520
commit
99add1733c
@ -51,12 +51,11 @@ impl<W: AsyncWrite + Unpin> Builder<W> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Adds a new entry to this archive with the specified path.
|
/// Adds a new entry to this archive with the specified path.
|
||||||
pub async fn add_entry<P: AsRef<Path>, R: AsyncRead + Unpin>(
|
pub async fn add_entry<P, R>(&mut self, header: &mut Header, path: P, data: R) -> io::Result<()>
|
||||||
&mut self,
|
where
|
||||||
header: &mut Header,
|
P: AsRef<Path>,
|
||||||
path: P,
|
R: AsyncRead + Unpin,
|
||||||
data: R,
|
{
|
||||||
) -> io::Result<()> {
|
|
||||||
append_path_header(&mut self.inner, header, path.as_ref()).await?;
|
append_path_header(&mut self.inner, header, path.as_ref()).await?;
|
||||||
header.set_cksum();
|
header.set_cksum();
|
||||||
self.add(&header, data).await
|
self.add(&header, data).await
|
||||||
@ -97,11 +96,11 @@ impl<W: AsyncWrite + Unpin> Builder<W> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn append_data<W: AsyncWrite + Unpin, R: AsyncRead + Unpin>(
|
async fn append_data<W, R>(mut dst: &mut W, header: &Header, mut data: &mut R) -> io::Result<()>
|
||||||
mut dst: &mut W,
|
where
|
||||||
header: &Header,
|
W: AsyncWrite + Unpin,
|
||||||
mut data: &mut R,
|
R: AsyncRead + Unpin,
|
||||||
) -> io::Result<()> {
|
{
|
||||||
dst.write_all(header.as_bytes()).await?;
|
dst.write_all(header.as_bytes()).await?;
|
||||||
let len = tokio::io::copy(&mut data, &mut dst).await?;
|
let len = tokio::io::copy(&mut data, &mut dst).await?;
|
||||||
|
|
||||||
@ -130,11 +129,10 @@ fn get_gnu_header(size: u64, entry_type: EntryType) -> Header {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// tries to set the path in header, or add a gnu header with 'LongName'
|
// tries to set the path in header, or add a gnu header with 'LongName'
|
||||||
async fn append_path_header<W: AsyncWrite + Unpin>(
|
async fn append_path_header<W>(dst: &mut W, header: &mut Header, path: &Path) -> io::Result<()>
|
||||||
dst: &mut W,
|
where
|
||||||
header: &mut Header,
|
W: AsyncWrite + Unpin,
|
||||||
path: &Path,
|
{
|
||||||
) -> io::Result<()> {
|
|
||||||
let mut relpath = PathBuf::new();
|
let mut relpath = PathBuf::new();
|
||||||
let components = path.components();
|
let components = path.components();
|
||||||
for comp in components {
|
for comp in components {
|
||||||
|
Loading…
Reference in New Issue
Block a user