5
0
mirror of git://git.proxmox.com/git/proxmox-backup.git synced 2025-01-03 01:18:02 +03:00

clippy: use div_ceil to calculate fixed index length

no semantic changes intended

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2024-12-02 11:37:06 +01:00
parent a50e0014df
commit 77fd1853b3

View File

@ -90,7 +90,7 @@ impl FixedIndexReader {
let ctime = i64::from_le(header.ctime);
let chunk_size = u64::from_le(header.chunk_size);
let index_length = ((size + chunk_size - 1) / chunk_size) as usize;
let index_length = size.div_ceil(chunk_size) as usize;
let index_size = index_length * 32;
let expected_index_size = (stat.st_size as usize) - header_size;
@ -285,7 +285,7 @@ impl FixedIndexWriter {
file.write_all(&buffer)?;
let index_length = (size + chunk_size - 1) / chunk_size;
let index_length = size.div_ceil(chunk_size);
let index_size = index_length * 32;
nix::unistd::ftruncate(file.as_raw_fd(), (header_size + index_size) as i64)?;