[pbs-devel] [PATCH backup 2/3] chunker: do not reassign context's total field
Maximiliano Sandoval
m.sandoval at proxmox.com
Mon Dec 2 14:10:07 CET 2024
```
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 at proxmox.com>
---
pbs-datastore/src/chunker.rs | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/pbs-datastore/src/chunker.rs b/pbs-datastore/src/chunker.rs
index bf1e8d8df..f6892e086 100644
--- a/pbs-datastore/src/chunker.rs
+++ b/pbs-datastore/src/chunker.rs
@@ -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();
--
2.39.5
More information about the pbs-devel
mailing list