src/pxar/format_definition.rs - PxarAttributes: derive Default

And remove unnecessary impl new().
This commit is contained in:
Dietmar Maurer 2019-08-02 07:16:10 +02:00
parent a92e6c9011
commit 27e6e180b6
2 changed files with 2 additions and 18 deletions

View File

@ -301,7 +301,7 @@ pub struct CaFormatQuotaProjID {
pub projid: u64, pub projid: u64,
} }
#[derive(Debug)] #[derive(Debug, Default)]
pub struct PxarAttributes { pub struct PxarAttributes {
pub xattrs: Vec<CaFormatXAttr>, pub xattrs: Vec<CaFormatXAttr>,
pub fcaps: Option<CaFormatFCaps>, pub fcaps: Option<CaFormatFCaps>,
@ -314,22 +314,6 @@ pub struct PxarAttributes {
pub acl_default_group: Vec<CaFormatACLGroup>, pub acl_default_group: Vec<CaFormatACLGroup>,
} }
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. /// Create SipHash values for goodby tables.
//pub fn compute_goodbye_hash(name: &std::ffi::CStr) -> u64 { //pub fn compute_goodbye_hash(name: &std::ffi::CStr) -> u64 {
pub fn compute_goodbye_hash(name: &[u8]) -> u64 { pub fn compute_goodbye_hash(name: &[u8]) -> u64 {

View File

@ -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> { 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 head: CaFormatHeader = self.read_item()?;
let mut size = (head.size - HEADER_SIZE) as usize; let mut size = (head.size - HEADER_SIZE) as usize;
loop { loop {