[pbs-devel] [PATCH backup 4/5] sg_pt_changer: remove needless call to as_bytes()

Maximiliano Sandoval m.sandoval at proxmox.com
Mon Jan 13 14:25:52 CET 2025


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 at 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





More information about the pbs-devel mailing list