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 4/5] sg_pt_changer: remove needless call to as_bytes()
Date: Mon, 13 Jan 2025 14:25:52 +0100	[thread overview]
Message-ID: <20250113132553.435319-4-m.sandoval@proxmox.com> (raw)
In-Reply-To: <20250113132553.435319-1-m.sandoval@proxmox.com>

Fixes:

warning: needless call to `as_bytes()`
   --> pbs-tape/src/sg_pt_changer.rs:913:45
    |
913 |             let rem = SCSI_VOLUME_TAG_LEN - voltag.as_bytes().len();
    |                                             ^^^^^^^^^^^^^^^^^^^^^^^ help: `len()` can be called directly on strings: `voltag.len()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_as_bytes
    = note: `#[warn(clippy::needless_as_bytes)]` on by default

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 pbs-tape/src/sg_pt_changer.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pbs-tape/src/sg_pt_changer.rs b/pbs-tape/src/sg_pt_changer.rs
index 940eed4a..7122fcdb 100644
--- a/pbs-tape/src/sg_pt_changer.rs
+++ b/pbs-tape/src/sg_pt_changer.rs
@@ -910,7 +910,7 @@ mod test {
 
         if let Some(voltag) = &desc.pvoltag {
             res.extend_from_slice(voltag.as_bytes());
-            let rem = SCSI_VOLUME_TAG_LEN - voltag.as_bytes().len();
+            let rem = SCSI_VOLUME_TAG_LEN - voltag.len();
             if rem > 0 {
                 res.resize(res.len() + rem, 0);
             }
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


  parent reply	other threads:[~2025-01-13 13:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-13 13:25 [pbs-devel] [PATCH backup 1/5] backup: remove unneded import Maximiliano Sandoval
2025-01-13 13:25 ` [pbs-devel] [PATCH backup 2/5] metric_collection: remove redundant map_or Maximiliano Sandoval
2025-01-13 13:25 ` [pbs-devel] [PATCH backup 3/5] elide lifetimes when possible Maximiliano Sandoval
2025-01-13 13:25 ` Maximiliano Sandoval [this message]
2025-01-13 13:25 ` [pbs-devel] [PATCH backup 5/5] replace match statements with ? operator Maximiliano Sandoval
2025-01-14  7:59 ` [pbs-devel] applied: [PATCH backup 1/5] backup: remove unneded import Dietmar Maurer

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=20250113132553.435319-4-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