pbs-datastore: clippy fixes

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2023-05-17 17:35:42 +02:00
parent 3db2022713
commit a57413a54c
8 changed files with 11 additions and 11 deletions

View File

@ -18,7 +18,7 @@ fn run() -> Result<(), Error> {
None => None, None => None,
}; };
let store = unsafe { DataStore::open_path("", &base, None)? }; let store = unsafe { DataStore::open_path("", base, None)? };
for ns in store.recursive_iter_backup_ns_ok(Default::default(), max_depth)? { for ns in store.recursive_iter_backup_ns_ok(Default::default(), max_depth)? {
println!("found namespace store:/{}", ns); println!("found namespace store:/{}", ns);

View File

@ -644,7 +644,7 @@ impl<R: Read + Seek> CatalogReader<R> {
} }
CatalogEntryType::File => { CatalogEntryType::File => {
let mut mtime_string = mtime.to_string(); let mut mtime_string = mtime.to_string();
if let Ok(s) = proxmox_time::strftime_local("%FT%TZ", mtime as i64) { if let Ok(s) = proxmox_time::strftime_local("%FT%TZ", mtime) {
mtime_string = s; mtime_string = s;
} }

View File

@ -27,8 +27,8 @@ impl ChunkStat {
impl std::fmt::Debug for ChunkStat { impl std::fmt::Debug for ChunkStat {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
let avg = ((self.size as f64) / (self.chunk_count as f64)) as usize; let avg = ((self.size as f64) / (self.chunk_count as f64)) as usize;
let compression = (self.compressed_size * 100) / (self.size as u64); let compression = (self.compressed_size * 100) / self.size;
let rate = (self.disk_size * 100) / (self.size as u64); let rate = (self.disk_size * 100) / self.size;
let elapsed = self.start_time.elapsed().unwrap(); let elapsed = self.start_time.elapsed().unwrap();
let elapsed = (elapsed.as_secs() as f64) + (elapsed.subsec_millis() as f64) / 1000.0; let elapsed = (elapsed.as_secs() as f64) + (elapsed.subsec_millis() as f64) / 1000.0;

View File

@ -183,7 +183,7 @@ impl ChunkStore {
let lockfile_path = Self::lockfile_path(&base); let lockfile_path = Self::lockfile_path(&base);
let locker = ProcessLocker::new(&lockfile_path)?; let locker = ProcessLocker::new(lockfile_path)?;
Ok(ChunkStore { Ok(ChunkStore {
name: name.to_owned(), name: name.to_owned(),

View File

@ -855,7 +855,7 @@ impl DataStore {
use walkdir::WalkDir; use walkdir::WalkDir;
let walker = WalkDir::new(&base).into_iter(); let walker = WalkDir::new(base).into_iter();
// make sure we skip .chunks (and other hidden files to keep it simple) // make sure we skip .chunks (and other hidden files to keep it simple)
fn is_hidden(entry: &walkdir::DirEntry) -> bool { fn is_hidden(entry: &walkdir::DirEntry) -> bool {

View File

@ -247,7 +247,7 @@ impl IndexFile for DynamicIndexReader {
} }
fn index_size(&self) -> usize { fn index_size(&self) -> usize {
self.size as usize self.size
} }
fn chunk_from_offset(&self, offset: u64) -> Option<(usize, u64)> { fn chunk_from_offset(&self, offset: u64) -> Option<(usize, u64)> {

View File

@ -130,7 +130,7 @@ fn paperkey_html<W: Write>(
writeln!(output, "</p>")?; writeln!(output, "</p>")?;
let qr_code = generate_qr_code("svg", block)?; let qr_code = generate_qr_code("svg", block)?;
let qr_code = base64::encode_config(&qr_code, base64::STANDARD_NO_PAD); let qr_code = base64::encode_config(qr_code, base64::STANDARD_NO_PAD);
writeln!(output, "<center>")?; writeln!(output, "<center>")?;
writeln!(output, "<img")?; writeln!(output, "<img")?;
@ -164,7 +164,7 @@ fn paperkey_html<W: Write>(
writeln!(output, "</p>")?; writeln!(output, "</p>")?;
let qr_code = generate_qr_code("svg", lines)?; let qr_code = generate_qr_code("svg", lines)?;
let qr_code = base64::encode_config(&qr_code, base64::STANDARD_NO_PAD); let qr_code = base64::encode_config(qr_code, base64::STANDARD_NO_PAD);
writeln!(output, "<center>")?; writeln!(output, "<center>")?;
writeln!(output, "<img")?; writeln!(output, "<img")?;

View File

@ -47,7 +47,7 @@ fn open_lock_file(name: &str) -> Result<(std::fs::File, CreateOptions), Error> {
let timeout = std::time::Duration::new(10, 0); let timeout = std::time::Duration::new(10, 0);
Ok(( Ok((
open_file_locked(&lock_path, timeout, true, options.clone())?, open_file_locked(lock_path, timeout, true, options.clone())?,
options, options,
)) ))
} }
@ -64,7 +64,7 @@ fn get_active_operations_do(
None None
}; };
let data = match file_read_optional_string(&path)? { let data = match file_read_optional_string(path)? {
Some(data) => serde_json::from_str::<Vec<TaskOperations>>(&data)? Some(data) => serde_json::from_str::<Vec<TaskOperations>>(&data)?
.iter() .iter()
.filter_map( .filter_map(