]> git.proxmox.com Git - pxar.git/commitdiff
formatting fixups
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 24 Jun 2020 09:53:55 +0000 (11:53 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 24 Jun 2020 09:53:55 +0000 (11:53 +0200)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/decoder/mod.rs
src/encoder/mod.rs
src/format/mod.rs
src/util.rs

index a9301e680ac61e06283ad7402030e346aaebf72a..1bfbcb9175072fd96c42800a5b261d29ead62356 100644 (file)
@@ -75,9 +75,7 @@ impl<'a> SeqRead for &mut (dyn SeqRead + 'a) {
 }
 
 /// awaitable version of `poll_position`.
-async fn seq_read_position<T: SeqRead + ?Sized>(
-    input: &mut T,
-) -> Option<io::Result<u64>> {
+async fn seq_read_position<T: SeqRead + ?Sized>(input: &mut T) -> Option<io::Result<u64>> {
     poll_fn(|cx| unsafe { Pin::new_unchecked(&mut *input).poll_position(cx) }).await
 }
 
@@ -379,10 +377,7 @@ impl<I: SeqRead> DecoderImpl<I> {
 
             Ok(Some(self.entry.take()))
         } else {
-            io_bail!(
-                "expected pxar entry of type 'Entry', got: {}",
-                header,
-            );
+            io_bail!("expected pxar entry of type 'Entry', got: {}", header,);
         }
     }
 
index 41b45830a70dd4fd44e6806420317efdcb8d43c1..f100939b1650c575344e8d42748d233238689589 100644 (file)
@@ -140,11 +140,7 @@ where
     let header = format::Header::with_content_size(htype, data.len() as u64);
     header.check_header_size()?;
 
-    seq_write_struct(
-        &mut *output,
-        header,
-    )
-    .await?;
+    seq_write_struct(&mut *output, header).await?;
     seq_write_all(output, data).await
 }
 
@@ -157,11 +153,7 @@ where
     let header = format::Header::with_content_size(htype, 1 + data.len() as u64);
     header.check_header_size()?;
 
-    seq_write_struct(
-        &mut *output,
-        header,
-    )
-    .await?;
+    seq_write_struct(&mut *output, header).await?;
     seq_write_all(&mut *output, data).await?;
     seq_write_all(output, &[0u8]).await
 }
@@ -315,11 +307,7 @@ impl<'a, T: SeqWrite + 'a> EncoderImpl<'a, T> {
         let header = format::Header::with_content_size(format::PXAR_PAYLOAD, file_size);
         header.check_header_size()?;
 
-        seq_write_struct(
-            &mut self.output,
-            header,
-        )
-        .await?;
+        seq_write_struct(&mut self.output, header).await?;
 
         let payload_data_offset = seq_write_position(&mut self.output).await?;
 
index 6a779006d8316784f318dc6ce31800b92bf681a0..eefd3211cf30f37380443e7b901a93d1fa69e231 100644 (file)
@@ -125,7 +125,12 @@ impl Header {
         }
 
         if self.content_size() > self.max_content_size() {
-            io_bail!("invalid content size ({} > {}) of entry with {}", self.content_size(), self.max_content_size(), self);
+            io_bail!(
+                "invalid content size ({} > {}) of entry with {}",
+                self.content_size(),
+                self.max_content_size(),
+                self
+            );
         }
         Ok(())
     }
index 7389cb2110feab489e521f21085bde16db33bc6d..8026a7f11e038443a81f9e8852a5c0db10c3e4db 100644 (file)
@@ -130,11 +130,11 @@ unsafe fn forbid_wake(_: *const ()) {
 
 unsafe fn ignore_drop(_: *const ()) {}
 
-pub const MAX_PATH_LEN:u64 = 4 * 1024;
+pub const MAX_PATH_LEN: u64 = 4 * 1024;
 // let's play it safe
-pub const MAX_FILENAME_LEN:u64 = MAX_PATH_LEN;
+pub const MAX_FILENAME_LEN: u64 = MAX_PATH_LEN;
 // name + attr
-pub const MAX_XATTR_LEN:u64 = 255 + 64*1024;
+pub const MAX_XATTR_LEN: u64 = 255 + 64 * 1024;
 
 pub fn validate_filename(name: &[u8]) -> io::Result<()> {
     if name.is_empty() {