avoid some clippy warnings

This commit is contained in:
Dietmar Maurer
2019-10-25 18:44:51 +02:00
parent f58f426e86
commit 834a2f95a0
13 changed files with 71 additions and 80 deletions

View File

@ -471,12 +471,12 @@ impl<'a, W: Write, C: BackupCatalogWriter> Encoder<'a, W, C> {
let projid = fsxattr.fsx_projid as u64;
if projid == 0 {
return Ok(None);
Ok(None)
} else {
return Ok(Some(PxarQuotaProjID { projid }));
Ok(Some(PxarQuotaProjID { projid }))
}
}
_ => return Ok(None),
_ => Ok(None),
}
}
@ -680,12 +680,10 @@ impl<'a, W: Write, C: BackupCatalogWriter> Encoder<'a, W, C> {
let include_children;
if is_virtual_file_system(magic) {
include_children = false;
} else if let Some(set) = &self.device_set {
include_children = set.contains(&dir_stat.st_dev);
} else {
if let Some(set) = &self.device_set {
include_children = set.contains(&dir_stat.st_dev);
} else {
include_children = true;
}
include_children = true;
}
// Expand the exclude match pattern inherited from the parent by local entries, if present
@ -1036,12 +1034,10 @@ impl<'a, W: Write, C: BackupCatalogWriter> Encoder<'a, W, C> {
let include_payload;
if is_virtual_file_system(magic) {
include_payload = false;
} else if let Some(ref set) = &self.device_set {
include_payload = set.contains(&stat.st_dev);
} else {
if let Some(ref set) = &self.device_set {
include_payload = set.contains(&stat.st_dev);
} else {
include_payload = true;
}
include_payload = true;
}
if !include_payload {
@ -1178,12 +1174,10 @@ impl<'a, W: Write, C: BackupCatalogWriter> Encoder<'a, W, C> {
let include_payload;
if is_virtual_file_system(magic) {
include_payload = false;
} else if let Some(set) = &self.device_set {
include_payload = set.contains(&stat.st_dev);
} else {
if let Some(set) = &self.device_set {
include_payload = set.contains(&stat.st_dev);
} else {
include_payload = true;
}
include_payload = true;
}
if !include_payload {

View File

@ -35,42 +35,42 @@ pub const WITH_FLAG_COMPR: u64 = 0x40000;
/// Linux file attribute `NOCOW`
pub const WITH_FLAG_NOCOW: u64 = 0x80000;
/// Linux file attribute `NODUMP`
pub const WITH_FLAG_NODUMP: u64 = 0x100000;
pub const WITH_FLAG_NODUMP: u64 = 0x0010_0000;
/// Linux file attribute `DIRSYNC`
pub const WITH_FLAG_DIRSYNC: u64 = 0x200000;
pub const WITH_FLAG_DIRSYNC: u64 = 0x0020_0000;
/// Linux file attribute `IMMUTABLE`
pub const WITH_FLAG_IMMUTABLE: u64 = 0x400000;
pub const WITH_FLAG_IMMUTABLE: u64 = 0x0040_0000;
/// Linux file attribute `SYNC`
pub const WITH_FLAG_SYNC: u64 = 0x800000;
pub const WITH_FLAG_SYNC: u64 = 0x0080_0000;
/// Linux file attribute `NOCOMP`
pub const WITH_FLAG_NOCOMP: u64 = 0x1000000;
pub const WITH_FLAG_NOCOMP: u64 = 0x0100_0000;
/// Linux file attribute `PROJINHERIT`
pub const WITH_FLAG_PROJINHERIT: u64 = 0x2000000;
pub const WITH_FLAG_PROJINHERIT: u64 = 0x0200_0000;
/// Preserve BTRFS subvolume flag
pub const WITH_SUBVOLUME: u64 = 0x4000000;
pub const WITH_SUBVOLUME: u64 = 0x0400_0000;
/// Preserve BTRFS read-only subvolume flag
pub const WITH_SUBVOLUME_RO: u64 = 0x8000000;
pub const WITH_SUBVOLUME_RO: u64 = 0x0800_0000;
/// Preserve Extended Attribute metadata
pub const WITH_XATTRS: u64 = 0x10000000;
pub const WITH_XATTRS: u64 = 0x1000_0000;
/// Preserve Access Control List metadata
pub const WITH_ACL: u64 = 0x20000000;
pub const WITH_ACL: u64 = 0x2000_0000;
/// Preserve SELinux security context
pub const WITH_SELINUX: u64 = 0x40000000;
pub const WITH_SELINUX: u64 = 0x4000_0000;
/// Preserve "security.capability" xattr
pub const WITH_FCAPS: u64 = 0x80000000;
pub const WITH_FCAPS: u64 = 0x8000_0000;
/// Preserve XFS/ext4/ZFS project quota ID
pub const WITH_QUOTA_PROJID: u64 = 0x100000000;
pub const WITH_QUOTA_PROJID: u64 = 0x0001_0000_0000;
/// Support ".pxarexclude" files
pub const EXCLUDE_FILE: u64 = 0x1000000000000000;
pub const EXCLUDE_FILE: u64 = 0x1000_0000_0000_0000;
/// Exclude submounts
pub const EXCLUDE_SUBMOUNTS: u64 = 0x4000000000000000;
pub const EXCLUDE_SUBMOUNTS: u64 = 0x4000_0000_0000_0000;
/// Exclude entries with chattr flag NODUMP
pub const EXCLUDE_NODUMP: u64 = 0x8000000000000000;
pub const EXCLUDE_NODUMP: u64 = 0x8000_0000_0000_0000;
/// Definitions of typical feature flags for the *pxar* encoder/decoder.
/// By this expensive syscalls for unsupported features are avoided.
@ -138,16 +138,16 @@ pub const DEFAULT: u64 =
EXCLUDE_FILE;
// form /usr/include/linux/fs.h
const FS_APPEND_FL: u32 = 0x00000020;
const FS_NOATIME_FL: u32 = 0x00000080;
const FS_COMPR_FL: u32 = 0x00000004;
const FS_NOCOW_FL: u32 = 0x00800000;
const FS_NODUMP_FL: u32 = 0x00000040;
const FS_DIRSYNC_FL: u32 = 0x00010000;
const FS_IMMUTABLE_FL: u32 = 0x00000010;
const FS_SYNC_FL: u32 = 0x00000008;
const FS_NOCOMP_FL: u32 = 0x00000400;
const FS_PROJINHERIT_FL: u32 = 0x20000000;
const FS_APPEND_FL: u32 = 0x0000_0020;
const FS_NOATIME_FL: u32 = 0x0000_0080;
const FS_COMPR_FL: u32 = 0x0000_0004;
const FS_NOCOW_FL: u32 = 0x0080_0000;
const FS_NODUMP_FL: u32 = 0x0000_0040;
const FS_DIRSYNC_FL: u32 = 0x0001_0000;
const FS_IMMUTABLE_FL: u32 = 0x0000_0010;
const FS_SYNC_FL: u32 = 0x0000_0008;
const FS_NOCOMP_FL: u32 = 0x0000_0400;
const FS_PROJINHERIT_FL: u32 = 0x2000_0000;
static CHATTR_MAP: [(u64, u32); 10] = [
( WITH_FLAG_APPEND, FS_APPEND_FL ),

View File

@ -10,6 +10,7 @@ use endian_trait::Endian;
use failure::{bail, Error};
use siphasher::sip::SipHasher24;
/// Header types identifying items stored in the archive
pub const PXAR_ENTRY: u64 = 0x1396fabcea5bbb51;
pub const PXAR_FILENAME: u64 = 0x6dbb6ebcb3161f0b;

View File

@ -233,7 +233,7 @@ impl Session {
Ok(Self {
ptr: session_ptr,
verbose: verbose,
verbose,
})
}

View File

@ -1196,13 +1196,13 @@ fn nsec_to_update_timespec(mtime_nsec: u64) -> [libc::timespec; 2] {
}
fn mode_user_to_acl_permissions(mode: u64) -> u64 {
return (mode >> 6) & 7;
(mode >> 6) & 7
}
fn mode_group_to_acl_permissions(mode: u64) -> u64 {
return (mode >> 3) & 7;
(mode >> 3) & 7
}
fn mode_other_to_acl_permissions(mode: u64) -> u64 {
return mode & 7;
mode & 7
}