Skip to content

Commit

Permalink
refactor: apply cargo clippy --fix
Browse files Browse the repository at this point in the history
Fixes `clippy::needless_borrows_for_generic_args` which is enabled in
nightly clippy
  • Loading branch information
b-zee committed Jul 26, 2024
1 parent 54233f7 commit 64a1560
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ impl StreamSelfDecryptor {
// Drain any in-order chunks due to the recent filled in piece.
fn drain_unprocessed(&mut self) -> Result<()> {
while let Some(chunk_name) = self.encrypted_chunks.get(&self.chunk_index) {
let file_path = self.temp_dir.path().join(&hex::encode(chunk_name));
let file_path = self.temp_dir.path().join(hex::encode(chunk_name));
let mut chunk_file = File::open(file_path)?;
let mut chunk_data = Vec::new();
let _ = chunk_file.read_to_end(&mut chunk_data)?;
Expand Down Expand Up @@ -363,7 +363,7 @@ pub fn encrypt_from_file(file_path: &Path, output_dir: &Path) -> Result<(DataMap
let chunk_name = XorName::from_content(&chunk.content);
chunk_names.push(chunk_name);

let file_path = output_dir.join(&hex::encode(chunk_name));
let file_path = output_dir.join(hex::encode(chunk_name));
let mut output_file = File::create(file_path)?;
output_file.write_all(&chunk.content)?;
}
Expand All @@ -381,7 +381,7 @@ pub fn decrypt_from_chunk_files(
let mut encrypted_chunks = Vec::new();
for chunk_info in data_map.infos() {
let chunk_name = chunk_info.dst_hash;
let file_path = chunk_dir.join(&hex::encode(chunk_name));
let file_path = chunk_dir.join(hex::encode(chunk_name));
let mut chunk_file = File::open(file_path)?;
let mut chunk_data = Vec::new();
let _ = chunk_file.read_to_end(&mut chunk_data)?;
Expand Down
2 changes: 1 addition & 1 deletion src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ fn test_stream_self_encryptor() -> Result<(), Error> {
// Use the flushed encrypted chunks to recover the file and verify with the original data
let mut flushed_encrypted_chunks = Vec::new();
for chunk_info in data_map.infos() {
let file_path = chunk_path.join(&hex::encode(chunk_info.dst_hash));
let file_path = chunk_path.join(hex::encode(chunk_info.dst_hash));
let mut chunk_file = File::open(file_path)?;
let mut chunk_data = Vec::new();
let _ = chunk_file.read_to_end(&mut chunk_data)?;
Expand Down

0 comments on commit 64a1560

Please sign in to comment.