]> git.proxmox.com Git - proxmox-backup.git/blobdiff - src/backup/fixed_index.rs
clippy: remove unnecessary closures
[proxmox-backup.git] / src / backup / fixed_index.rs
index 44ebfabe1b9d3944345eb1640829ec35230c044b..279537deb12b4a0e4943b90324f4eaf8891f9927 100644 (file)
@@ -3,7 +3,7 @@ use std::io::{Seek, SeekFrom};
 
 use super::chunk_stat::*;
 use super::chunk_store::*;
-use super::{IndexFile, ChunkReadInfo};
+use super::{ChunkReadInfo, IndexFile};
 use crate::tools;
 
 use std::fs::File;
@@ -60,7 +60,7 @@ impl FixedIndexReader {
     pub fn open(path: &Path) -> Result<Self, Error> {
         File::open(path)
             .map_err(Error::from)
-            .and_then(|file| Self::new(file))
+            .and_then(Self::new)
             .map_err(|err| format_err!("Unable to open fixed index {:?} - {}", path, err))
     }
 
@@ -69,8 +69,7 @@ impl FixedIndexReader {
 
         let header_size = std::mem::size_of::<FixedIndexHeader>();
 
-        let rawfd = file.as_raw_fd();
-        let stat = match nix::sys::stat::fstat(rawfd) {
+        let stat = match nix::sys::stat::fstat(file.as_raw_fd()) {
             Ok(stat) => stat,
             Err(err) => bail!("fstat failed - {}", err),
         };
@@ -94,7 +93,6 @@ impl FixedIndexReader {
         let index_length = ((size + chunk_size - 1) / chunk_size) as usize;
         let index_size = index_length * 32;
 
-
         let expected_index_size = (stat.st_size as usize) - header_size;
         if index_size != expected_index_size {
             bail!(
@@ -150,7 +148,7 @@ impl FixedIndexReader {
         println!("ChunkSize: {}", self.chunk_size);
 
         let mut ctime_str = self.ctime.to_string();
-        if let Ok(s) = proxmox::tools::time::strftime_local("%c",self.ctime) {
+        if let Ok(s) = proxmox::tools::time::strftime_local("%c", self.ctime) {
             ctime_str = s;
         }
 
@@ -215,7 +213,7 @@ impl IndexFile for FixedIndexReader {
 
         Some((
             (offset / self.chunk_size as u64) as usize,
-            offset & (self.chunk_size - 1) as u64 // fast modulo, valid for 2^x chunk_size
+            offset & (self.chunk_size - 1) as u64, // fast modulo, valid for 2^x chunk_size
         ))
     }
 }