summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-07-30 13:24:39 +0300
committerLars Wirzenius <liw@liw.fi>2021-07-30 13:30:18 +0300
commitd95a6470a4bcd9a28ae5603b863820921a05e969 (patch)
treeeca9853a840fe5027a51c010963929482269b0d3 /src
parentcc3524fd60169a66c8a4e2178448bf5f6d07c99b (diff)
downloadobnam2-d95a6470a4bcd9a28ae5603b863820921a05e969.tar.gz
cleanup: fix things rustc/clipppy now complain about
Mostly https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow. Sponsored-by: author
Diffstat (limited to 'src')
-rw-r--r--src/backup_run.rs10
-rw-r--r--src/bin/benchmark-index.rs2
-rw-r--r--src/bin/benchmark-indexedstore.rs2
-rw-r--r--src/bin/benchmark-store.rs2
-rw-r--r--src/bin/obnam-server.rs2
-rw-r--r--src/cipher.rs2
-rw-r--r--src/cmd/list_files.rs2
-rw-r--r--src/cmd/restore.rs8
-rw-r--r--src/generation.rs8
9 files changed, 19 insertions, 19 deletions
diff --git a/src/backup_run.rs b/src/backup_run.rs
index 738830d..dee1d11 100644
--- a/src/backup_run.rs
+++ b/src/backup_run.rs
@@ -98,7 +98,7 @@ impl<'a> BackupRun<'a> {
oldname: &Path,
) -> Result<LocalGeneration, ObnamError> {
let progress = BackupProgress::download_generation(genid);
- let old = self.client.fetch_generation(genid, &oldname)?;
+ let old = self.client.fetch_generation(genid, oldname)?;
progress.finish();
Ok(old)
}
@@ -126,7 +126,7 @@ impl<'a> BackupRun<'a> {
new_cachedir_tags.push(path);
}
};
- self.backup(entry, &old)
+ self.backup(entry, old)
});
let mut new_warnings = new.insert_iter(entries)?;
warnings.append(&mut new_warnings);
@@ -156,15 +156,15 @@ impl<'a> BackupRun<'a> {
let path = &entry.inner.pathbuf();
info!("backup: {}", path.display());
self.found_live_file(path);
- let reason = self.policy.needs_backup(&old, &entry.inner);
+ let reason = self.policy.needs_backup(old, &entry.inner);
match reason {
Reason::IsNew
| Reason::Changed
| Reason::GenerationLookupError
| Reason::Unknown => Ok(backup_file(
- &self.client,
+ self.client,
&entry,
- &path,
+ path,
self.buffer_size,
reason,
)),
diff --git a/src/bin/benchmark-index.rs b/src/bin/benchmark-index.rs
index b5a059c..4df8354 100644
--- a/src/bin/benchmark-index.rs
+++ b/src/bin/benchmark-index.rs
@@ -84,7 +84,7 @@ fn lookup(index: &mut Index, num: u32) -> anyhow::Result<()> {
loop {
let gen = ChunkGenerator::new(num);
for (_, _, chunk) in gen {
- index.find_by_sha256(&chunk.meta().sha256())?;
+ index.find_by_sha256(chunk.meta().sha256())?;
done += 1;
if done >= num {
return Ok(());
diff --git a/src/bin/benchmark-indexedstore.rs b/src/bin/benchmark-indexedstore.rs
index 5cd3ff1..1479cb9 100644
--- a/src/bin/benchmark-indexedstore.rs
+++ b/src/bin/benchmark-indexedstore.rs
@@ -83,7 +83,7 @@ fn lookup(index: &mut IndexedStore, num: u32) -> anyhow::Result<()> {
loop {
let gen = ChunkGenerator::new(num);
for (_, _, chunk) in gen {
- index.find_by_sha256(&chunk.meta().sha256())?;
+ index.find_by_sha256(chunk.meta().sha256())?;
done += 1;
if done >= num {
return Ok(());
diff --git a/src/bin/benchmark-store.rs b/src/bin/benchmark-store.rs
index 7896f9d..da54590 100644
--- a/src/bin/benchmark-store.rs
+++ b/src/bin/benchmark-store.rs
@@ -21,7 +21,7 @@ fn main() -> anyhow::Result<()> {
let store = Store::new(&opt.chunks);
for (id, _, chunk) in gen {
- store.save(&id, &&chunk)?;
+ store.save(&id, &chunk)?;
}
Ok(())
diff --git a/src/bin/obnam-server.rs b/src/bin/obnam-server.rs
index 29ea9ff..1a469e6 100644
--- a/src/bin/obnam-server.rs
+++ b/src/bin/obnam-server.rs
@@ -85,7 +85,7 @@ async fn main() -> anyhow::Result<()> {
}
fn load_config(filename: &Path) -> Result<ServerConfig, anyhow::Error> {
- let config = ServerConfig::read_config(&filename).with_context(|| {
+ let config = ServerConfig::read_config(filename).with_context(|| {
format!(
"Couldn't read default configuration file {}",
filename.display()
diff --git a/src/cipher.rs b/src/cipher.rs
index f19dc78..b8e02f2 100644
--- a/src/cipher.rs
+++ b/src/cipher.rs
@@ -95,7 +95,7 @@ impl CipherEngine {
let payload = Payload::from(payload.as_slice());
let meta = std::str::from_utf8(meta)?;
- let meta = ChunkMeta::from_str(&meta)?;
+ let meta = ChunkMeta::from_str(meta)?;
let chunk = DataChunk::new(payload.msg.to_vec(), meta);
diff --git a/src/cmd/list_files.rs b/src/cmd/list_files.rs
index 723781b..e511327 100644
--- a/src/cmd/list_files.rs
+++ b/src/cmd/list_files.rs
@@ -30,7 +30,7 @@ impl ListFiles {
let gen = client.fetch_generation(&gen_id, temp.path()).await?;
for file in gen.files()?.iter()? {
let file = file?;
- println!("{}", format_entry(&file.entry(), file.reason()));
+ println!("{}", format_entry(file.entry(), file.reason()));
}
Ok(())
diff --git a/src/cmd/restore.rs b/src/cmd/restore.rs
index 458397d..c770501 100644
--- a/src/cmd/restore.rs
+++ b/src/cmd/restore.rs
@@ -141,11 +141,11 @@ async fn restore_generation(
let to = restored_path(entry, to)?;
match entry.kind() {
- FilesystemKind::Regular => restore_regular(client, &gen, &to, fileid, &entry).await?,
+ FilesystemKind::Regular => restore_regular(client, gen, &to, fileid, entry).await?,
FilesystemKind::Directory => restore_directory(&to)?,
- FilesystemKind::Symlink => restore_symlink(&to, &entry)?,
- FilesystemKind::Socket => restore_socket(&to, &entry)?,
- FilesystemKind::Fifo => restore_fifo(&to, &entry)?,
+ FilesystemKind::Symlink => restore_symlink(&to, entry)?,
+ FilesystemKind::Socket => restore_socket(&to, entry)?,
+ FilesystemKind::Fifo => restore_fifo(&to, entry)?,
}
Ok(())
}
diff --git a/src/generation.rs b/src/generation.rs
index d770235..25fc14d 100644
--- a/src/generation.rs
+++ b/src/generation.rs
@@ -475,14 +475,14 @@ mod test {
let mut gen = NascentGeneration::create(&dbfile).unwrap();
gen.insert(
- FilesystemEntry::from_metadata(&nontag_path1, &metadata).unwrap(),
+ FilesystemEntry::from_metadata(nontag_path1, &metadata).unwrap(),
&[],
Reason::IsNew,
false,
)
.unwrap();
gen.insert(
- FilesystemEntry::from_metadata(&tag_path1, &metadata).unwrap(),
+ FilesystemEntry::from_metadata(tag_path1, &metadata).unwrap(),
&[],
Reason::IsNew,
true,
@@ -491,13 +491,13 @@ mod test {
let entries = vec![
Ok(FsEntryBackupOutcome {
- entry: FilesystemEntry::from_metadata(&nontag_path2, &metadata).unwrap(),
+ entry: FilesystemEntry::from_metadata(nontag_path2, &metadata).unwrap(),
ids: vec![],
reason: Reason::IsNew,
is_cachedir_tag: false,
}),
Ok(FsEntryBackupOutcome {
- entry: FilesystemEntry::from_metadata(&tag_path2, &metadata).unwrap(),
+ entry: FilesystemEntry::from_metadata(tag_path2, &metadata).unwrap(),
ids: vec![],
reason: Reason::IsNew,
is_cachedir_tag: true,