tree-wide: fix needless borrows

found and fixed via clippy

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler
2021-12-30 12:57:37 +01:00
parent a0c69902c8
commit 9a37bd6c84
104 changed files with 238 additions and 241 deletions

View File

@ -37,7 +37,7 @@ impl BackupRepository {
return auth_id;
}
&Authid::root_auth_id()
Authid::root_auth_id()
}
pub fn user(&self) -> &Userid {

View File

@ -321,7 +321,7 @@ impl BackupWriter {
self.h2.clone(),
wid,
stream,
&prefix,
prefix,
known_chunks.clone(),
if options.encrypt {
self.crypt_config.clone()

View File

@ -529,7 +529,7 @@ impl Shell {
};
let new_stack =
Self::lookup(&stack, &mut *catalog, accessor, Some(path), follow_symlinks).await?;
Self::lookup(stack, &mut *catalog, accessor, Some(path), follow_symlinks).await?;
*stack = new_stack;
@ -993,7 +993,7 @@ impl Shell {
&mut self.catalog,
dir_stack,
extractor,
&match_list,
match_list,
&self.accessor,
)?;
@ -1118,7 +1118,7 @@ impl<'a> ExtractorState<'a> {
self.path_len_stack.push(self.path_len);
self.path_len = self.path.len();
Shell::walk_pxar_archive(&self.accessor, &mut self.dir_stack).await?;
Shell::walk_pxar_archive(self.accessor, &mut self.dir_stack).await?;
let dir_pxar = self.dir_stack.last().unwrap().pxar.as_ref().unwrap();
let dir_meta = dir_pxar.entry().metadata().clone();
let create = self.matches && match_result != Some(MatchType::Exclude);
@ -1141,7 +1141,7 @@ impl<'a> ExtractorState<'a> {
}
(true, DirEntryAttribute::File { .. }) => {
self.dir_stack.push(PathStackEntry::new(entry));
let file = Shell::walk_pxar_archive(&self.accessor, &mut self.dir_stack).await?;
let file = Shell::walk_pxar_archive(self.accessor, &mut self.dir_stack).await?;
self.extract_file(file).await?;
self.dir_stack.pop();
}
@ -1153,7 +1153,7 @@ impl<'a> ExtractorState<'a> {
| (true, DirEntryAttribute::Hardlink) => {
let attr = entry.attr.clone();
self.dir_stack.push(PathStackEntry::new(entry));
let file = Shell::walk_pxar_archive(&self.accessor, &mut self.dir_stack).await?;
let file = Shell::walk_pxar_archive(self.accessor, &mut self.dir_stack).await?;
self.extract_special(file, attr).await?;
self.dir_stack.pop();
}

View File

@ -547,7 +547,7 @@ impl Archiver {
None => return Ok(()),
};
let metadata = get_metadata(fd.as_raw_fd(), &stat, self.flags(), self.fs_magic, &mut self.fs_feature_flags)?;
let metadata = get_metadata(fd.as_raw_fd(), stat, self.flags(), self.fs_magic, &mut self.fs_feature_flags)?;
if self
.patterns
@ -629,14 +629,14 @@ impl Archiver {
catalog.lock().unwrap().add_block_device(c_file_name)?;
}
self.add_device(encoder, file_name, &metadata, &stat).await
self.add_device(encoder, file_name, &metadata, stat).await
}
mode::IFCHR => {
if let Some(ref catalog) = self.catalog {
catalog.lock().unwrap().add_char_device(c_file_name)?;
}
self.add_device(encoder, file_name, &metadata, &stat).await
self.add_device(encoder, file_name, &metadata, stat).await
}
other => bail!(
"encountered unknown file type: 0x{:x} (0o{:o})",
@ -656,7 +656,7 @@ impl Archiver {
) -> Result<(), Error> {
let dir_name = OsStr::from_bytes(dir_name.to_bytes());
let mut encoder = encoder.create_directory(dir_name, &metadata).await?;
let mut encoder = encoder.create_directory(dir_name, metadata).await?;
let old_fs_magic = self.fs_magic;
let old_fs_feature_flags = self.fs_feature_flags;
@ -820,17 +820,17 @@ fn get_xattr_fcaps_acl(
};
for attr in &xattrs {
if xattr::is_security_capability(&attr) {
if xattr::is_security_capability(attr) {
get_fcaps(meta, fd, flags, fs_feature_flags)?;
continue;
}
if xattr::is_acl(&attr) {
if xattr::is_acl(attr) {
get_acl(meta, proc_path, flags, fs_feature_flags)?;
continue;
}
if !xattr::is_valid_xattr_name(&attr) {
if !xattr::is_valid_xattr_name(attr) {
continue;
}

View File

@ -649,7 +649,7 @@ impl SessionImpl {
#[inline]
fn to_entry(entry: &FileEntry) -> Result<EntryParam, Error> {
to_entry_param(to_inode(&entry), &entry)
to_entry_param(to_inode(entry), entry)
}
#[inline]

View File

@ -50,7 +50,7 @@ impl RemoteChunkReader {
let mut chunk_data = Vec::with_capacity(4 * 1024 * 1024);
self.client
.download_chunk(&digest, &mut chunk_data)
.download_chunk(digest, &mut chunk_data)
.await?;
let chunk = DataBlob::load_from_reader(&mut &chunk_data[..])?;

View File

@ -110,7 +110,7 @@ pub async fn view_task_result(
display_task_log(client, upid, true).await?;
}
} else {
format_and_print_result(&data, &output_format);
format_and_print_result(data, output_format);
}
Ok(())

View File

@ -319,7 +319,7 @@ pub async fn complete_server_file_name_do(param: &HashMap<String, String>) -> Ve
pub fn complete_archive_name(arg: &str, param: &HashMap<String, String>) -> Vec<String> {
complete_server_file_name(arg, param)
.iter()
.map(|v| pbs_tools::format::strip_server_file_extension(&v).to_owned())
.map(|v| pbs_tools::format::strip_server_file_extension(v).to_owned())
.collect()
}