diff --git a/Cargo.toml b/Cargo.toml index 5524c83a8..7820ac0a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -211,7 +211,6 @@ missing_transmute_annotations = "deny" mut_mut = "deny" needless_bitwise_bool = "deny" needless_character_iteration = "deny" -needless_continue = "deny" needless_for_each = "deny" needless_maybe_sized = "deny" needless_raw_string_hashes = "deny" diff --git a/consensus/context/src/difficulty.rs b/consensus/context/src/difficulty.rs index e3ec0219c..541d6c20f 100644 --- a/consensus/context/src/difficulty.rs +++ b/consensus/context/src/difficulty.rs @@ -348,7 +348,7 @@ fn get_window_start_and_end( if window_len <= accounted_window { (0, window_len) } else { - let start = (window_len - (accounted_window) + 1) / 2; + let start = (window_len - (accounted_window)).div_ceil(2); (start, start + accounted_window) } } diff --git a/cryptonight/src/slow_hash.rs b/cryptonight/src/slow_hash.rs index 489f5b8aa..cc41e88f1 100644 --- a/cryptonight/src/slow_hash.rs +++ b/cryptonight/src/slow_hash.rs @@ -49,7 +49,7 @@ impl CnSlowHashState { &self.b } - fn get_keccak_bytes_mut(&mut self) -> &mut [u8; KECCAK1600_BYTE_SIZE] { + const fn get_keccak_bytes_mut(&mut self) -> &mut [u8; KECCAK1600_BYTE_SIZE] { &mut self.b } diff --git a/net/epee-encoding/src/error.rs b/net/epee-encoding/src/error.rs index 7206189a7..528fa7bd6 100644 --- a/net/epee-encoding/src/error.rs +++ b/net/epee-encoding/src/error.rs @@ -27,6 +27,10 @@ impl Error { } } + #[expect( + clippy::missing_const_for_fn, + reason = "False-positive, `::deref` is not const" + )] fn field_data(&self) -> &str { match self { Self::IO(data) | Self::Format(data) => data, diff --git a/net/levin/src/lib.rs b/net/levin/src/lib.rs index 298ed9bbc..e40f40a99 100644 --- a/net/levin/src/lib.rs +++ b/net/levin/src/lib.rs @@ -194,11 +194,11 @@ impl BucketBuilder { } } - pub fn set_signature(&mut self, sig: u64) { + pub const fn set_signature(&mut self, sig: u64) { self.signature = Some(sig); } - pub fn set_message_type(&mut self, ty: MessageType) { + pub const fn set_message_type(&mut self, ty: MessageType) { self.ty = Some(ty); } @@ -206,11 +206,11 @@ impl BucketBuilder { self.command = Some(command); } - pub fn set_return_code(&mut self, code: i32) { + pub const fn set_return_code(&mut self, code: i32) { self.return_code = Some(code); } - pub fn set_protocol_version(&mut self, version: u32) { + pub const fn set_protocol_version(&mut self, version: u32) { self.protocol_version = Some(version); } diff --git a/p2p/p2p-core/src/client/weak.rs b/p2p/p2p-core/src/client/weak.rs index 27ff3c589..aefeff0c6 100644 --- a/p2p/p2p-core/src/client/weak.rs +++ b/p2p/p2p-core/src/client/weak.rs @@ -45,7 +45,7 @@ impl WeakClient { /// Create a [`WeakBroadcastClient`] from this [`WeakClient`]. /// /// See the docs for [`WeakBroadcastClient`] for what this type can do. - pub fn broadcast_client(&mut self) -> WeakBroadcastClient<'_, N> { + pub const fn broadcast_client(&mut self) -> WeakBroadcastClient<'_, N> { WeakBroadcastClient(self) } } diff --git a/p2p/p2p/src/connection_maintainer.rs b/p2p/p2p/src/connection_maintainer.rs index 245fbf122..bf9dc69d9 100644 --- a/p2p/p2p/src/connection_maintainer.rs +++ b/p2p/p2p/src/connection_maintainer.rs @@ -98,10 +98,7 @@ where /// Connects to random seeds to get peers and immediately disconnects #[instrument(level = "info", skip(self))] - #[expect( - clippy::significant_drop_in_scrutinee, - clippy::significant_drop_tightening - )] + #[expect(clippy::significant_drop_tightening)] async fn connect_to_random_seeds(&mut self) -> Result<(), OutboundConnectorError> { let seeds = self .config @@ -161,7 +158,6 @@ where tokio::spawn( async move { - #[expect(clippy::significant_drop_in_scrutinee)] if let Ok(Ok(peer)) = timeout(HANDSHAKE_TIMEOUT, connection_fut).await { drop(new_peers_tx.send(peer).await); }