mirror of
https://github.com/Cuprate/cuprate.git
synced 2025-04-23 06:18:12 +00:00
ci: fix clippy (#428)
* cargo clippy * fix * remove `needless_continue` * readd `continue`
This commit is contained in:
parent
d3b7ca3e65
commit
3ef6a96d04
7 changed files with 12 additions and 13 deletions
|
@ -216,7 +216,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"
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,10 @@ impl Error {
|
|||
}
|
||||
}
|
||||
|
||||
#[expect(
|
||||
clippy::missing_const_for_fn,
|
||||
reason = "False-positive, `<String as Deref>::deref` is not const"
|
||||
)]
|
||||
fn field_data(&self) -> &str {
|
||||
match self {
|
||||
Self::IO(data) | Self::Format(data) => data,
|
||||
|
|
|
@ -194,11 +194,11 @@ impl<C: LevinCommand> BucketBuilder<C> {
|
|||
}
|
||||
}
|
||||
|
||||
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<C: LevinCommand> BucketBuilder<C> {
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ impl<N: NetworkZone> WeakClient<N> {
|
|||
/// 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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue