From 27e6e180b6ca873966e97f3c36f9b9adfa8511a2 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Fri, 2 Aug 2019 07:16:10 +0200 Subject: [PATCH] src/pxar/format_definition.rs - PxarAttributes: derive Default And remove unnecessary impl new(). --- src/pxar/format_definition.rs | 18 +----------------- src/pxar/sequential_decoder.rs | 2 +- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/src/pxar/format_definition.rs b/src/pxar/format_definition.rs index 25593c9a..3851934e 100644 --- a/src/pxar/format_definition.rs +++ b/src/pxar/format_definition.rs @@ -301,7 +301,7 @@ pub struct CaFormatQuotaProjID { pub projid: u64, } -#[derive(Debug)] +#[derive(Debug, Default)] pub struct PxarAttributes { pub xattrs: Vec, pub fcaps: Option, @@ -314,22 +314,6 @@ pub struct PxarAttributes { pub acl_default_group: Vec, } -impl PxarAttributes { - pub fn new() -> Self { - Self { - xattrs: Vec::new(), - fcaps: None, - quota_projid: None, - acl_user: Vec::new(), - acl_group: Vec::new(), - acl_group_obj: None, - acl_default: None, - acl_default_user: Vec::new(), - acl_default_group: Vec::new(), - } - } -} - /// Create SipHash values for goodby tables. //pub fn compute_goodbye_hash(name: &std::ffi::CStr) -> u64 { pub fn compute_goodbye_hash(name: &[u8]) -> u64 { diff --git a/src/pxar/sequential_decoder.rs b/src/pxar/sequential_decoder.rs index d1918670..30216cb9 100644 --- a/src/pxar/sequential_decoder.rs +++ b/src/pxar/sequential_decoder.rs @@ -179,7 +179,7 @@ impl <'a, R: Read, F: Fn(&Path) -> Result<(), Error>> SequentialDecoder<'a, R, F } fn read_attributes(&mut self) -> Result<(CaFormatHeader, PxarAttributes), Error> { - let mut attr = PxarAttributes::new(); + let mut attr = PxarAttributes::default(); let mut head: CaFormatHeader = self.read_item()?; let mut size = (head.size - HEADER_SIZE) as usize; loop {