[pbs-devel] [PATCH proxmox v2 13/18] http: remove unnecessary cast

Maximiliano Sandoval m.sandoval at proxmox.com
Wed Jun 26 14:43:41 CEST 2024


Fixes the clippy warning:

warning: casting to the same type is unnecessary (`usize` -> `usize`)
   --> proxmox-http/src/websocket/mod.rs:446:40
    |
446 |             mask.copy_from_slice(&data[mask_offset as usize..payload_offset as usize]);
    |                                        ^^^^^^^^^^^^^^^^^^^^ help: try: `mask_offset`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
    = note: `#[warn(clippy::unnecessary_cast)]` on by default

Signed-off-by: Maximiliano Sandoval <m.sandoval at proxmox.com>
---
 proxmox-http/src/websocket/mod.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proxmox-http/src/websocket/mod.rs b/proxmox-http/src/websocket/mod.rs
index b3179e1f..6d3faea6 100644
--- a/proxmox-http/src/websocket/mod.rs
+++ b/proxmox-http/src/websocket/mod.rs
@@ -441,7 +441,7 @@ impl FrameHeader {
                 return Ok(None);
             }
             let mut mask = [0u8; 4];
-            mask.copy_from_slice(&data[mask_offset as usize..payload_offset as usize]);
+            mask.copy_from_slice(&data[mask_offset..payload_offset as usize]);
             Some(mask)
         } else {
             None
-- 
2.39.2





More information about the pbs-devel mailing list