clippy: misc. fixes
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
@ -585,6 +585,7 @@ impl <R: Read + Seek> CatalogReader<R> {
|
||||
///
|
||||
/// Stores 7 bits per byte, Bit 8 indicates the end of the sequence (when not set).
|
||||
/// If the value is negative, we end with a zero byte (0x00).
|
||||
#[allow(clippy::neg_multiply)]
|
||||
pub fn catalog_encode_i64<W: Write>(writer: &mut W, v: i64) -> Result<(), Error> {
|
||||
let mut enc = Vec::new();
|
||||
|
||||
@ -617,6 +618,7 @@ pub fn catalog_encode_i64<W: Write>(writer: &mut W, v: i64) -> Result<(), Error>
|
||||
/// We currently read maximal 11 bytes, which give a maximum of 70 bits + sign.
|
||||
/// this method is compatible with catalog_encode_u64 iff the
|
||||
/// value encoded is <= 2^63 (values > 2^63 cannot be represented in an i64)
|
||||
#[allow(clippy::neg_multiply)]
|
||||
pub fn catalog_decode_i64<R: Read>(reader: &mut R) -> Result<i64, Error> {
|
||||
|
||||
let mut v: u64 = 0;
|
||||
|
@ -408,9 +408,7 @@ impl <'a, 'b> DataChunkBuilder<'a, 'b> {
|
||||
chunk_size: usize,
|
||||
compress: bool,
|
||||
) -> Result<(DataBlob, [u8; 32]), Error> {
|
||||
|
||||
let mut zero_bytes = Vec::with_capacity(chunk_size);
|
||||
zero_bytes.resize(chunk_size, 0u8);
|
||||
let zero_bytes = vec![0; chunk_size];
|
||||
let mut chunk_builder = DataChunkBuilder::new(&zero_bytes).compress(compress);
|
||||
if let Some(ref crypt_config) = crypt_config {
|
||||
chunk_builder = chunk_builder.crypt_config(crypt_config);
|
||||
|
@ -476,12 +476,11 @@ impl DataStore {
|
||||
let image_list = self.list_images()?;
|
||||
let image_count = image_list.len();
|
||||
|
||||
let mut done = 0;
|
||||
let mut last_percentage: usize = 0;
|
||||
|
||||
let mut strange_paths_count: u64 = 0;
|
||||
|
||||
for img in image_list {
|
||||
for (i, img) in image_list.into_iter().enumerate() {
|
||||
|
||||
worker.check_abort()?;
|
||||
tools::fail_on_shutdown()?;
|
||||
@ -514,15 +513,14 @@ impl DataStore {
|
||||
Err(err) if err.kind() == io::ErrorKind::NotFound => (), // ignore vanished files
|
||||
Err(err) => bail!("can't open index {} - {}", img.to_string_lossy(), err),
|
||||
}
|
||||
done += 1;
|
||||
|
||||
let percentage = done*100/image_count;
|
||||
let percentage = (i + 1) * 100 / image_count;
|
||||
if percentage > last_percentage {
|
||||
crate::task_log!(
|
||||
worker,
|
||||
"marked {}% ({} of {} index files)",
|
||||
percentage,
|
||||
done,
|
||||
i + 1,
|
||||
image_count,
|
||||
);
|
||||
last_percentage = percentage;
|
||||
|
Reference in New Issue
Block a user