public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH backup 3/4] report: inline errors in writeln!
Date: Tue, 13 Feb 2024 10:53:19 +0100	[thread overview]
Message-ID: <20240213095320.186188-3-m.sandoval@proxmox.com> (raw)
In-Reply-To: <20240213095320.186188-1-m.sandoval@proxmox.com>

Fixes the clippy lint:

```
warning: `to_string` applied to a type that implements `Display` in `writeln!` args
   --> src/server/report.rs:141:72
    |
141 |                 let _ = writeln!(out, "error during read-dir - {}", err.to_string());
    |                                                                        ^^^^^^^^^^^^ help: remove this
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_format_args
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 src/server/report.rs | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/server/report.rs b/src/server/report.rs
index d97efb14..ca5f04fc 100644
--- a/src/server/report.rs
+++ b/src/server/report.rs
@@ -126,9 +126,8 @@ fn get_directory_content(path: impl AsRef<Path>) -> String {
         Ok(iter) => iter,
         Err(err) => {
             return format!(
-                "`$ cat '{}*'`\n```\n# read dir failed - {}\n```",
+                "`$ cat '{}*'`\n```\n# read dir failed - {err}\n```",
                 path.as_ref().display(),
-                err.to_string(),
             );
         }
     };
@@ -138,7 +137,7 @@ fn get_directory_content(path: impl AsRef<Path>) -> String {
         let entry = match entry {
             Ok(entry) => entry,
             Err(err) => {
-                let _ = writeln!(out, "error during read-dir - {}", err.to_string());
+                let _ = writeln!(out, "error during read-dir - {err}");
                 continue;
             }
         };
-- 
2.39.2





  parent reply	other threads:[~2024-02-13  9:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-13  9:53 [pbs-devel] [PATCH backup 1/4] disks: remove useless conversion to the same type Maximiliano Sandoval
2024-02-13  9:53 ` [pbs-devel] [PATCH backup 2/4] backup-proxy: avoid block in if condition Maximiliano Sandoval
2024-02-13 10:29   ` Fabian Grünbichler
2024-02-13  9:53 ` Maximiliano Sandoval [this message]
2024-02-13  9:53 ` [pbs-devel] [PATCH backup 4/4] api: use if-let pattern for error-only handling Maximiliano Sandoval
2024-02-13 10:26   ` Fabian Grünbichler
2024-02-13 10:30 ` [pbs-devel] partially-applied: [PATCH backup 1/4] disks: remove useless conversion to the same type Fabian Grünbichler

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=20240213095320.186188-3-m.sandoval@proxmox.com \
    --to=m.sandoval@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal