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

chunker: do not reassign context's total field

```
warning: field assignment outside of initializer for an instance created with Default::default()
   --> pbs-datastore/src/chunker.rs:431:5
    |
431 |     ctx.total = buffer.len() as u64;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: consider initializing the variable with `chunker::Context { total: buffer.len() as u64, ..Default::default() }` and removing relevant reassignments
   --> pbs-datastore/src/chunker.rs:430:5
    |
430 |     let mut ctx = Context::default();
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
    = note: `#[warn(clippy::field_reassign_with_default)]` on by default
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
This commit is contained in:
Maximiliano Sandoval 2024-12-02 14:10:07 +01:00 committed by Fabian Grünbichler
parent 47a29b1896
commit 109e063a7e

View File

@ -427,8 +427,10 @@ fn test_suggested_boundary() {
chunks1.push((last, buffer.len() - last));
let mut pos = 0;
let mut ctx = Context::default();
ctx.total = buffer.len() as u64;
let mut ctx = Context {
total: buffer.len() as u64,
..Default::default()
};
chunker.reset();
// Suggest chunk boundary within regular chunk
tx.send(32 * 1024).unwrap();