From 5307b3f7627f7d9b6f6d69aff495b421f851f476 Mon Sep 17 00:00:00 2001 From: Gwen Lg Date: Sun, 25 Jan 2026 22:44:02 +0100 Subject: [PATCH] chore: remove unnecessary cast usize lint message: casting to the same type is unnecessary (`u64` -> `u64`) help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#unnecessary_cast + disable `clippy::unnecessary_cast` for update_disk_usage where the size of the input values depends on the platform --- src/db/fjall_adapter.rs | 2 +- src/net/recv.rs | 2 +- src/rpc/system.rs | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/db/fjall_adapter.rs b/src/db/fjall_adapter.rs index 1a9919f2..9e9efe9f 100644 --- a/src/db/fjall_adapter.rs +++ b/src/db/fjall_adapter.rs @@ -287,7 +287,7 @@ impl<'a> ITx for FjallTx<'a> { } fn len(&self, tree_idx: usize) -> TxOpResult { let tree = self.get_tree(tree_idx)?; - Ok(self.tx.len(tree)? as usize) + Ok(self.tx.len(tree)?) } fn insert(&mut self, tree_idx: usize, key: &[u8], value: &[u8]) -> TxOpResult<()> { diff --git a/src/net/recv.rs b/src/net/recv.rs index 50705f24..24961903 100644 --- a/src/net/recv.rs +++ b/src/net/recv.rs @@ -89,7 +89,7 @@ pub(crate) trait RecvLoop: Sync + 'static { let has_cont = (size & CHUNK_FLAG_HAS_CONTINUATION) != 0; let is_error = (size & CHUNK_FLAG_ERROR) != 0; let size = (size & CHUNK_LENGTH_MASK) as usize; - let mut next_slice = vec![0; size as usize]; + let mut next_slice = vec![0; size]; read.read_exact(&mut next_slice[..]).await?; let packet = if is_error { diff --git a/src/rpc/system.rs b/src/rpc/system.rs index 107102b0..d7e0741a 100644 --- a/src/rpc/system.rs +++ b/src/rpc/system.rs @@ -856,6 +856,7 @@ impl NodeStatus { }; let mount_avail = |path: &Path| match statvfs(path) { + #[allow(clippy::unnecessary_cast)] Ok(x) => { let avail = x.blocks_available() as u64 * x.fragment_size() as u64; let total = x.blocks() as u64 * x.fragment_size() as u64;