Fix warnings in preparation for Rust 1.54.0
This CL fixes several new warnings generated by rustc 1.54.0.
Bug: 194812675
Test: m rust
Change-Id: I104aaf07897db4df89dd1598969dd74221bfdd0b
diff --git a/authfs/src/fsverity/builder.rs b/authfs/src/fsverity/builder.rs
index 1842425..fda47bc 100644
--- a/authfs/src/fsverity/builder.rs
+++ b/authfs/src/fsverity/builder.rs
@@ -248,7 +248,7 @@
let mut tree = MerkleLeaves::new();
for (index, chunk) in test_data.chunks(CHUNK_SIZE as usize).enumerate() {
let hash = Sha256Hasher::new()?
- .update(&chunk)?
+ .update(chunk)?
.update(&vec![0u8; CHUNK_SIZE as usize - chunk.len()])?
.finalize()?;
diff --git a/authfs/src/fsverity/editor.rs b/authfs/src/fsverity/editor.rs
index 8468cc9..86ff4d6 100644
--- a/authfs/src/fsverity/editor.rs
+++ b/authfs/src/fsverity/editor.rs
@@ -206,7 +206,7 @@
// (original) integrity for the file. To matches what write(2) describes for an error
// case (though it's about direct I/O), "Partial data may be written ... should be
// considered inconsistent", an error below is propagated.
- self.file.write_all_at(&source, output_offset)?;
+ self.file.write_all_at(source, output_offset)?;
// Update the hash only after the write succeeds. Note that this only attempts to keep
// the tree consistent to what has been written regardless the actual state beyond the
@@ -290,7 +290,7 @@
if end > self.data.borrow().len() {
self.data.borrow_mut().resize(end, 0);
}
- self.data.borrow_mut().as_mut_slice()[begin..end].copy_from_slice(&buf);
+ self.data.borrow_mut().as_mut_slice()[begin..end].copy_from_slice(buf);
Ok(buf.len())
}
@@ -318,7 +318,7 @@
format!("read_chunk out of bound: index {}", chunk_index),
)
})?;
- buf[..chunk.len()].copy_from_slice(&chunk);
+ buf[..chunk.len()].copy_from_slice(chunk);
Ok(chunk.len())
}
}
diff --git a/authfs/src/fsverity/verifier.rs b/authfs/src/fsverity/verifier.rs
index 13de42a..1f21b13 100644
--- a/authfs/src/fsverity/verifier.rs
+++ b/authfs/src/fsverity/verifier.rs
@@ -33,7 +33,7 @@
fn hash_with_padding(chunk: &[u8], pad_to: usize) -> Result<HashBuffer, CryptoError> {
let padding_size = pad_to - chunk.len();
- Sha256Hasher::new()?.update(&chunk)?.update(&ZEROS[..padding_size])?.finalize()
+ Sha256Hasher::new()?.update(chunk)?.update(&ZEROS[..padding_size])?.finalize()
}
fn verity_check<T: ReadByChunk>(
@@ -47,7 +47,7 @@
// beyond the file size, including empty file.
assert_ne!(file_size, 0);
- let chunk_hash = hash_with_padding(&chunk, CHUNK_SIZE as usize)?;
+ let chunk_hash = hash_with_padding(chunk, CHUNK_SIZE as usize)?;
fsverity_walk(chunk_index, file_size, merkle_tree)?.try_fold(
chunk_hash,