Skip to content

Commit

Permalink
refactor: use std::mem::take instead of clone/clear
Browse files Browse the repository at this point in the history
  • Loading branch information
rklaehn committed Oct 25, 2022
1 parent c339004 commit a193ab4
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions iroh-resolver/src/unixfs_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -657,8 +657,7 @@ fn add_blocks_to_store_chunked<S: Store>(
let raw_data_size = block.raw_data_size();
tracing::info!("adding chunk of {} bytes", chunk_size);
if chunk_size + block_size > MAX_CHUNK_SIZE {
store.put_many(chunk.clone()).await?;
chunk.clear();
store.put_many(std::mem::take(&mut chunk)).await?;
chunk_size = 0;
}
chunk.push(block);
Expand Down

0 comments on commit a193ab4

Please sign in to comment.