From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Proxmox Backup Server development discussion
<pbs-devel@lists.proxmox.com>
Subject: [pbs-devel] applied-series: [PATCH backup 01/13] remove needless borrows
Date: Mon, 02 Dec 2024 12:20:18 +0100 [thread overview]
Message-ID: <1733138377.6xk083g6x8.astroid@yuna.none> (raw)
In-Reply-To: <20241202095808.128299-1-m.sandoval@proxmox.com>
the inspect_err code could be switched over to proper error context at
some point..
On December 2, 2024 10:57 am, Maximiliano Sandoval wrote:
> Fixes the needless_borrow lint.
>
> Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
> ---
> pbs-client/src/catalog_shell.rs | 6 +++---
> pbs-datastore/src/backup_info.rs | 2 +-
> pbs-datastore/src/datastore.rs | 2 +-
> proxmox-backup-client/src/catalog.rs | 4 ++--
> proxmox-backup-client/src/main.rs | 4 +---
> src/api2/node/apt.rs | 2 +-
> src/api2/node/disks/zfs.rs | 2 +-
> src/tools/disks/mod.rs | 4 ++--
> 8 files changed, 12 insertions(+), 14 deletions(-)
>
> diff --git a/pbs-client/src/catalog_shell.rs b/pbs-client/src/catalog_shell.rs
> index 7dace86bb..550daf56b 100644
> --- a/pbs-client/src/catalog_shell.rs
> +++ b/pbs-client/src/catalog_shell.rs
> @@ -529,7 +529,7 @@ impl Shell {
> None => bail!("no such file or directory: {entry:?}"),
> }
> } else {
> - let pxar_entry = parent_pxar_entry(&stack)?;
> + let pxar_entry = parent_pxar_entry(stack)?;
> let parent_dir = pxar_entry.enter_directory().await?;
> match parent_dir.lookup(entry).await? {
> Some(entry) => {
> @@ -575,7 +575,7 @@ impl Shell {
> None => bail!("no such file or directory: {:?}", entry),
> }
> } else {
> - let pxar_entry = parent_pxar_entry(&stack)?;
> + let pxar_entry = parent_pxar_entry(stack)?;
> let parent_dir = block_on(pxar_entry.enter_directory())?;
> match block_on(parent_dir.lookup(entry))? {
> Some(entry) => {
> @@ -766,7 +766,7 @@ impl Shell {
> let mut out = std::io::stdout();
> let items = crate::pxar::tools::pxar_metadata_read_dir(dir).await?;
> for item in items {
> - out.write_all(&item.file_name().as_bytes())?;
> + out.write_all(item.file_name().as_bytes())?;
> out.write_all(b"\n")?;
> }
> return Ok(());
> diff --git a/pbs-datastore/src/backup_info.rs b/pbs-datastore/src/backup_info.rs
> index be262773b..a92c47821 100644
> --- a/pbs-datastore/src/backup_info.rs
> +++ b/pbs-datastore/src/backup_info.rs
> @@ -428,7 +428,7 @@ impl BackupDir {
>
> std::fs::create_dir_all(&path)?;
> let ts = self.backup_time_string();
> - path.push(&format!("{ts}{MANIFEST_LOCK_NAME}"));
> + path.push(format!("{ts}{MANIFEST_LOCK_NAME}"));
>
> Ok(path)
> }
> diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs
> index 4c062e244..24d9eab2e 100644
> --- a/pbs-datastore/src/datastore.rs
> +++ b/pbs-datastore/src/datastore.rs
> @@ -1151,7 +1151,7 @@ impl DataStore {
> let _exclusive_lock = self.inner.chunk_store.try_exclusive_lock()?;
>
> let (config, _digest) = pbs_config::datastore::config()?;
> - let gc_store_config: DataStoreConfig = config.lookup("datastore", &self.name())?;
> + let gc_store_config: DataStoreConfig = config.lookup("datastore", self.name())?;
> let all_stores = config.convert_to_typed_array("datastore")?;
> if let Err(err) = gc_store_config.ensure_not_nested(&all_stores) {
> info!(
> diff --git a/proxmox-backup-client/src/catalog.rs b/proxmox-backup-client/src/catalog.rs
> index 0e20886a0..7173c8efc 100644
> --- a/proxmox-backup-client/src/catalog.rs
> +++ b/proxmox-backup-client/src/catalog.rs
> @@ -240,7 +240,7 @@ async fn catalog_shell(param: Value) -> Result<(), Error> {
> )
> .await?;
>
> - let state = Shell::new(None, &server_archive_name.as_ref(), accessor).await?;
> + let state = Shell::new(None, server_archive_name.as_ref(), accessor).await?;
> log::info!("Starting interactive shell");
> state.shell().await?;
> record_repository(&repo);
> @@ -283,7 +283,7 @@ async fn catalog_shell(param: Value) -> Result<(), Error> {
>
> catalogfile.seek(SeekFrom::Start(0))?;
> let catalog_reader = CatalogReader::new(catalogfile);
> - let state = Shell::new(Some(catalog_reader), &server_archive_name.as_ref(), decoder).await?;
> + let state = Shell::new(Some(catalog_reader), server_archive_name.as_ref(), decoder).await?;
>
> log::info!("Starting interactive shell");
> state.shell().await?;
> diff --git a/proxmox-backup-client/src/main.rs b/proxmox-backup-client/src/main.rs
> index 89f91e2b5..580feb626 100644
> --- a/proxmox-backup-client/src/main.rs
> +++ b/proxmox-backup-client/src/main.rs
> @@ -1017,9 +1017,7 @@ async fn create_backup(
> (BackupSpecificationType::PXAR, true) => {
> log_file("directory", &filename, target.as_ref())
> }
> - (BackupSpecificationType::IMAGE, true) => {
> - log_file("image", &filename, &target.as_ref())
> - }
> + (BackupSpecificationType::IMAGE, true) => log_file("image", &filename, target.as_ref()),
> // no dry-run
> (BackupSpecificationType::CONFIG, false) => {
> let upload_options = UploadOptions {
> diff --git a/src/api2/node/apt.rs b/src/api2/node/apt.rs
> index 672ef7bf7..8be6ee261 100644
> --- a/src/api2/node/apt.rs
> +++ b/src/api2/node/apt.rs
> @@ -181,7 +181,7 @@ pub fn get_versions() -> Result<Vec<APTUpdateInfo>, Error> {
> "proxmox-backup",
> "proxmox-backup-server",
> &running_daemon_version,
> - &PACKAGES,
> + PACKAGES,
> )
> }
>
> diff --git a/src/api2/node/disks/zfs.rs b/src/api2/node/disks/zfs.rs
> index a31320c54..b6cf18265 100644
> --- a/src/api2/node/disks/zfs.rs
> +++ b/src/api2/node/disks/zfs.rs
> @@ -290,7 +290,7 @@ pub fn create_zpool(
> let mut command = std::process::Command::new("zfs");
> command.arg("set");
> if let Some(compression) = compression {
> - command.arg(&format!("compression={}", compression));
> + command.arg(format!("compression={compression}"));
> }
> command.args(["relatime=on", &name]);
> info!("# {command:?}");
> diff --git a/src/tools/disks/mod.rs b/src/tools/disks/mod.rs
> index 61aceccd6..571446db2 100644
> --- a/src/tools/disks/mod.rs
> +++ b/src/tools/disks/mod.rs
> @@ -1215,7 +1215,7 @@ pub fn change_parttype(part_disk: &Disk, part_type: &str) -> Result<(), Error> {
> let minor = unsafe { libc::minor(stat.st_rdev) };
> let partnum_path = &format!("/sys/dev/block/{}:{}/partition", major, minor);
> let partnum: u32 = std::fs::read_to_string(partnum_path)?.trim_end().parse()?;
> - sgdisk_command.arg(&format!("-t{}:{}", partnum, part_type));
> + sgdisk_command.arg(format!("-t{}:{}", partnum, part_type));
> let part_disk_parent = match part_disk.parent() {
> Some(disk) => disk,
> None => bail!("disk {:?} has no node in /dev", part_disk.syspath()),
> @@ -1355,7 +1355,7 @@ pub fn get_fs_uuid(disk: &Disk) -> Result<String, Error> {
> /// Mount a disk by its UUID and the mount point.
> pub fn mount_by_uuid(uuid: &str, mount_point: &Path) -> Result<(), Error> {
> let mut command = std::process::Command::new("mount");
> - command.arg(&format!("UUID={uuid}"));
> + command.arg(format!("UUID={uuid}"));
> command.arg(mount_point);
>
> proxmox_sys::command::run_command(command, None)?;
> --
> 2.39.5
>
>
>
> _______________________________________________
> pbs-devel mailing list
> pbs-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
>
>
>
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
prev parent reply other threads:[~2024-12-02 11:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-02 9:57 [pbs-devel] " Maximiliano Sandoval
2024-12-02 9:57 ` [pbs-devel] [PATCH backup 02/13] use inspect_err when possible Maximiliano Sandoval
2024-12-02 9:57 ` [pbs-devel] [PATCH backup 03/13] backup_manager: use Vec::first instead of get(0) Maximiliano Sandoval
2024-12-02 9:57 ` [pbs-devel] [PATCH backup 04/13] push: use unwrap_or to prevent lazy evaluation Maximiliano Sandoval
2024-12-02 9:58 ` [pbs-devel] [PATCH backup 05/13] docs: use sublist indentation Maximiliano Sandoval
2024-12-02 9:58 ` [pbs-devel] [PATCH backup 06/13] client: remove unnecessary deref Maximiliano Sandoval
2024-12-02 9:58 ` [pbs-devel] [PATCH backup 07/13] remove needless type conversion Maximiliano Sandoval
2024-12-02 9:58 ` [pbs-devel] [PATCH backup 08/13] client: catalog: remove unnecessary sort_unstable_by Maximiliano Sandoval
2024-12-02 9:58 ` [pbs-devel] [PATCH backup 09/13] docs: fix outer docs comments Maximiliano Sandoval
2024-12-02 9:58 ` [pbs-devel] [PATCH backup 10/13] remove redundant imports Maximiliano Sandoval
2024-12-02 9:58 ` [pbs-devel] [PATCH backup 11/13] restore_daemon: use map_while instead of filter_map(Result::ok) Maximiliano Sandoval
2024-12-02 9:58 ` [pbs-devel] [PATCH backup 12/13] datastore: simplify let-else block with ? operator Maximiliano Sandoval
2024-12-02 9:58 ` [pbs-devel] [PATCH backup 13/13] api: config: run rustfmt Maximiliano Sandoval
2024-12-02 11:20 ` Fabian Grünbichler [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1733138377.6xk083g6x8.astroid@yuna.none \
--to=f.gruenbichler@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox