Fix clippy::manual_string_new

This commit is contained in:
Zachary Dremann 2023-01-13 21:05:18 -05:00 committed by Alexander Weiss
parent aeb7804f46
commit 9e689eded6
4 changed files with 9 additions and 9 deletions

View File

@ -18,9 +18,9 @@ pub trait DecryptReadBackend: ReadBackend {
fn read_encrypted_full(&self, tpe: FileType, id: &Id) -> Result<Bytes> {
let decrypted = self.decrypt(&self.read_full(tpe, id)?)?;
Ok(match decrypted[0] {
b'{' | b'[' => decrypted, // not compressed
2 => decode_all(&decrypted[1..])?, // 2 indicates compressed data following
Ok(match decrypted.first() {
Some(b'{' | b'[') => decrypted, // not compressed
Some(2) => decode_all(&decrypted[1..])?, // 2 indicates compressed data following
_ => bail!("not supported"),
}
.into())

View File

@ -81,7 +81,7 @@ impl<R: Read + Send> Iterator for ChunkIter<R> {
}
self.rabin
.reset_and_prefill_window(&mut vec[vec.len() - 64..vec.len()].iter().cloned());
.reset_and_prefill_window(&mut vec[vec.len() - 64..vec.len()].iter().copied());
loop {
if vec.len() >= self.max_size {

View File

@ -112,10 +112,10 @@ pub(super) fn execute(
("remove", "id argument".to_string())
} else {
match group_keep.matches(sn, last, iter.peek().is_some(), latest_time) {
None if default_keep => ("keep", "".to_string()),
None if default_keep => ("keep", String::new()),
None => {
forget_snaps.push(sn.id);
("remove", "".to_string())
("remove", String::new())
}
Some(reason) => ("keep", reason),
}

View File

@ -170,7 +170,7 @@ fn display_snap(sn: SnapshotFile) {
};
add_entry("Parent", parent);
if let Some(summary) = sn.summary {
add_entry("", "".to_string());
add_entry("", String::new());
add_entry("Command", summary.command);
let source = format!(
@ -180,7 +180,7 @@ fn display_snap(sn: SnapshotFile) {
bytes(summary.total_bytes_processed)
);
add_entry("Source", source);
add_entry("", "".to_string());
add_entry("", String::new());
let files = format!(
"new: {:>10} / changed: {:>10} / unchanged: {:>10}",
@ -193,7 +193,7 @@ fn display_snap(sn: SnapshotFile) {
summary.dirs_new, summary.dirs_changed, summary.dirs_unmodified,
);
add_entry("Dirs", trees);
add_entry("", "".to_string());
add_entry("", String::new());
let written = format!(
"data: {:>10} blobs / raw: {:>10} / packed: {:>10}\n\